Skip to content

Commit

Permalink
Merge branch 'release/2.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbentz-uf committed Apr 12, 2024
2 parents f18c1e3 + 4c6acf9 commit 89d5cb3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## v2.3.1 - 2024-04-12
### Added
* Add verbose support for `configure_logging` (Vaibhavi Deshpande)
* Make `JobStatus` fields nullable and increase job summary data length (Michael Bentz)

## v2.3.0 - 2024-02-22
### Added
* Add configure_logging (Michael Bentz)
Expand Down
5 changes: 4 additions & 1 deletion py_utils/log_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
log_filename = os.path.join(logs_dir, f"log-{todays_date}.log")


def configure_logging(handlers: List[logging.Handler] = []):
def configure_logging(handlers: List[logging.Handler] = [], verbose: bool = False):
"""Configures the root logger
Configures the root logger with default settings.
Args:
handlers (List[logging.Handler]): The handlers to add to the logger
verbose (bool): optional, if set to TRUE set Level to logging.DEBUG
Returns:
None
Expand All @@ -28,6 +29,8 @@ def configure_logging(handlers: List[logging.Handler] = []):

logger = logging.getLogger()
logger.setLevel(logging.INFO)
if verbose:
logger.setLevel(logging.DEBUG)

# create stream handler
stream_handler = logging.StreamHandler(sys.stderr)
Expand Down
18 changes: 9 additions & 9 deletions py_utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class JobStatus(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
created_date: datetime = Field(default=datetime.utcnow(), nullable=False)
modified_date: datetime = Field(default_factory=datetime.utcnow, nullable=False)
host: str
script_path: str
script_name: str
executed_by: str
script_start_time: datetime
script_end_time: datetime
elapsed_time: int
job_summary_data: str
level: JobStatusLevels
host: str = Field(nullable=True)
script_path: str = Field(nullable=True)
script_name: str = Field(nullable=True)
executed_by: str = Field(nullable=True)
script_start_time: datetime = Field(nullable=True)
script_end_time: datetime = Field(nullable=True)
elapsed_time: int = Field(nullable=True)
job_summary_data: str = Field(nullable=True, max_length=15000)
level: JobStatusLevels = Field(nullable=True)

def __str__(self):
return (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyutils"
version = "2.3.0"
version = "2.3.1"
description = ""
authors = ["Michael Bentz <mbentz@ufl.edu>"]
license = "MIT"
Expand Down

0 comments on commit 89d5cb3

Please sign in to comment.