Fix logger settings in utils

master
blallo 2019-02-07 12:02:16 +01:00 committed by blallo
parent 8f032090ed
commit bb97eb9e4f
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
1 changed files with 7 additions and 0 deletions

View File

@ -6,10 +6,17 @@ import errno
import logging
import json
import os
import sys
import typing as T
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()
DEC = json.JSONDecoder()