Skip to content

Commit

Permalink
Use __name__ instead of root for client result & common logger NREL#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
softwareengineerprogrammer committed Mar 7, 2024
1 parent 9a21531 commit aed5196
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/geophires_x_client/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
_geophires_x_client_logger = None


def _get_logger(logger_name='root'):
def _get_logger(logger_name=None):
global _geophires_x_client_logger
if _geophires_x_client_logger is None:
sh = logging.StreamHandler(sys.stdout)
sh.setLevel(logging.INFO)
sh.setFormatter(logging.Formatter(fmt='[%(asctime)s][%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S'))

if logger_name is None:
logger_name = __name__

_geophires_x_client_logger = logging.getLogger(logger_name)
_geophires_x_client_logger.addHandler(sh)

Expand Down
4 changes: 3 additions & 1 deletion src/geophires_x_client/geophires_x_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ class GeophiresXResult:
'Reservoir Model',
)

def __init__(self, output_file_path, logger_name='root'):
def __init__(self, output_file_path, logger_name=None):
if logger_name is None:
logger_name = __name__
self._logger = _get_logger(logger_name)
self.output_file_path = output_file_path

Expand Down

0 comments on commit aed5196

Please sign in to comment.