kas: define variable to store default log level

To make it easier to display (and modify) the default log level,
especially with the introduction of the new (future commit) argument
--log-level.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
[Jan: style fix]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Hugo Villeneuve 2023-05-03 16:53:36 +02:00 committed by Jan Kiszka
parent 88964d63b5
commit 246f23cbca

View File

@ -45,13 +45,15 @@ from . import plugins
__license__ = 'MIT'
__copyright__ = 'Copyright (c) Siemens AG, 2017-2018'
default_log_level = 'info'
def create_logger():
"""
Setup the logging environment
"""
log = logging.getLogger() # root logger
log.setLevel(logging.INFO)
log.setLevel(logging.getLevelName(default_log_level.upper()))
format_str = '%(asctime)s - %(levelname)-8s - %(message)s'
date_format = '%Y-%m-%d %H:%M:%S'
if HAVE_COLORLOG and os.isatty(2):