Skip to content

Commit

Permalink
feat: added date format to get_logger
Browse files Browse the repository at this point in the history
  • Loading branch information
jlerat committed Jan 29, 2024
1 parent 56b0f94 commit eac9cdd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hydrodiy/io/iutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def get_logger(name, level="INFO", \
excepthook=True,
no_duplicate_handler=True,\
contextual=False, \
start_message=True):
start_message=True, \
date_fmt="%y-%M-%d %H:%M"):
""" Get a logger object that can handle contextual info
Parameters
Expand Down Expand Up @@ -166,6 +167,8 @@ def get_logger(name, level="INFO", \
(see hydrodiy.io.HydrodiyContextualLogger)
start_message : bool
Log a "Process started" message.
date_fmt : str
Date format
Returns
-----------
Expand All @@ -184,7 +187,7 @@ def get_logger(name, level="INFO", \
logger.setLevel(getattr(logging, level))

# Set logging format
ft = logging.Formatter(fmt)
ft = logging.Formatter(fmt, date_fmt)

# Check handlers
has_console = False
Expand Down

0 comments on commit eac9cdd

Please sign in to comment.