Skip to content

Commit

Permalink
Fix multiple logging to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Drazzilb08 committed Feb 16, 2024
1 parent 485eebe commit 4082927
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion util/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def setup_logger(log_level, script_name, max_logs=9):

# Add the file handler to the logger
logger.addHandler(handler)

# Configure console logging with the specified log level
console_handler = logging.StreamHandler()
if log_level == 'DEBUG':
Expand All @@ -85,5 +85,10 @@ def setup_logger(log_level, script_name, max_logs=9):

# Add the console handler to the logger
logger.addHandler(console_handler)

# Overwrite previous logger if exists
logging.getLogger(script_name).handlers.clear()
logging.getLogger(script_name).addHandler(handler)
logging.getLogger(script_name).addHandler(console_handler)

return logger

0 comments on commit 4082927

Please sign in to comment.