From 738746e0d058ca472674e3b80842718f7713346a Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Fri, 18 Nov 2022 13:09:55 +0100 Subject: [PATCH] Allow overwite of log defaults --- pylibagent/logger.py | 9 ++++----- pylibagent/version.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pylibagent/logger.py b/pylibagent/logger.py index 1d1b611..167e8a1 100644 --- a/pylibagent/logger.py +++ b/pylibagent/logger.py @@ -2,11 +2,6 @@ import logging.handlers import os -_LOG_LEVEL = os.getenv('LOG_LEVEL', 'warning') -_LOG_COLORIZED = int(os.getenv('LOG_COLORIZED', '0')) -_LOG_DATE_FMT = os.getenv('LOG_FMT', '%y%m%d %H:%M:%S') - - _MAP_LOG_LEVELS = { 'DEBUG': logging.DEBUG, 'INFO': logging.INFO, @@ -19,6 +14,10 @@ def setup_logger(): """Setup logger.""" + _LOG_LEVEL = os.getenv('LOG_LEVEL', 'warning') + _LOG_COLORIZED = int(os.getenv('LOG_COLORIZED', '0')) + _LOG_DATE_FMT = os.getenv('LOG_FMT', '%y%m%d %H:%M:%S') + if _LOG_COLORIZED: # setup colorized formatter formatter = colorlog.ColoredFormatter( diff --git a/pylibagent/version.py b/pylibagent/version.py index 10939f0..8ce9b36 100644 --- a/pylibagent/version.py +++ b/pylibagent/version.py @@ -1 +1 @@ -__version__ = '0.1.2' +__version__ = '0.1.3'