Fix logger settings in utils

This commit is contained in:
sfigato 2019-02-07 12:02:16 +01:00 committed by blallo
parent 8f032090ed
commit bb97eb9e4f
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -6,10 +6,17 @@ import errno
import logging import logging
import json import json
import os import os
import sys
import typing as T import typing as T
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.setLevel(os.environ.get("BOTZ_LOGLEVEL", logging.INFO))
sh = logging.StreamHandler(stream=sys.stdout)
cli_filter = logging.Filter(__name__)
sh.addFilter(cli_filter)
sh.setFormatter(logging.Formatter("%(message)s"))
logger.addHandler(sh)
ENC = json.JSONEncoder() ENC = json.JSONEncoder()
DEC = json.JSONDecoder() DEC = json.JSONDecoder()