Fix problem with multiple loggers
This commit is contained in:
parent
a9619e1cc8
commit
23649bc86e
|
@ -12,8 +12,8 @@ class BaseCommand:
|
|||
self.cli_args = cli_args
|
||||
self.log_level = cli_args.log_level
|
||||
self.config = Config()
|
||||
self.logger = logging.getLogger(__name__)
|
||||
log.setup(level=self.log_level or self.config.log_level)
|
||||
self.logger = log.logger
|
||||
|
||||
def get_containers(self):
|
||||
"""Get running containers"""
|
||||
|
|
|
@ -25,4 +25,7 @@ def setup(level: str = 'warning'):
|
|||
# ch.setFormatter(logging.Formatter('%(asctime)s - {HOSTNAME} - %(name)s - %(levelname)s - %(message)s'))
|
||||
# ch.setFormatter(logging.Formatter('%(asctime)s - {HOSTNAME} - %(levelname)s - %(message)s'))
|
||||
ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: %(message)s'))
|
||||
logger.addHandler(ch)
|
||||
|
||||
# Prevent duplicate handlers
|
||||
if not logger.handlers:
|
||||
logger.addHandler(ch)
|
||||
|
|
Loading…
Reference in New Issue