From bb97eb9e4f0048f092fe385eece35a2d8761fbdd Mon Sep 17 00:00:00 2001 From: Blallo Date: Thu, 7 Feb 2019 12:02:16 +0100 Subject: [PATCH] Fix logger settings in utils --- bot_z/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bot_z/utils.py b/bot_z/utils.py index 821a8ba..7e03983 100644 --- a/bot_z/utils.py +++ b/bot_z/utils.py @@ -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()