Skip to content

Commit

Permalink
Initial blocks in place for forecast refactor work (#1466)
Browse files Browse the repository at this point in the history
This PR is a first in a series of PR for transforming the forecast job.
This PR does not affect current function of the forecast job.
This PR:
- adds initial blocks to separate task specific and model configuration for the task blocks
  • Loading branch information
aerorahul committed Apr 15, 2023
1 parent fa4e084 commit 3466407
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ush/python/pygw/src/pygw/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Logger
"""

import os
import sys
from functools import wraps
from pathlib import Path
Expand Down Expand Up @@ -48,7 +49,7 @@ class Logger:
DEFAULT_FORMAT = '%(asctime)s - %(levelname)-8s - %(name)-12s: %(message)s'

def __init__(self, name: str = None,
level: str = None,
level: str = os.environ.get("LOGGING_LEVEL"),
_format: str = DEFAULT_FORMAT,
colored_log: bool = False,
logfile_path: Union[str, Path] = None):
Expand All @@ -74,18 +75,15 @@ def __init__(self, name: str = None,
default : None
"""

if level is None:
level = os.environ.get("LOGGING_LEVEL", Logger.DEFAULT_LEVEL)

self.name = name
self.level = level.upper()
self.level = level.upper() if level else Logger.DEFAULT_LEVEL
self.format = _format
self.colored_log = colored_log

if self.level not in Logger.LOG_LEVELS:
raise LookupError('{self.level} is unknown logging level\n' +
'Currently supported log levels are:\n' +
f'{" | ".join(Logger.LOG_LEVELS)}')
raise LookupError(f"{self.level} is unknown logging level\n" +
f"Currently supported log levels are:\n" +
f"{' | '.join(Logger.LOG_LEVELS)}")

# Initialize the root logger if no name is present
self._logger = logging.getLogger(name) if name else logging.getLogger()
Expand Down

0 comments on commit 3466407

Please sign in to comment.