From 7218585ef83f880b653dc73bf4a0844b1fcd0730 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 7 Jan 2019 16:00:03 +0100 Subject: [PATCH] Changing init logging --- lib/webhooks/base_app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/webhooks/base_app.py b/lib/webhooks/base_app.py index 48b1726..bd3cf5d 100644 --- a/lib/webhooks/base_app.py +++ b/lib/webhooks/base_app.py @@ -35,6 +35,7 @@ import pytz # Own modules from fb_tools.common import pp, to_bytes, to_bool +from fb_tools.colored import ColoredFormatter from fb_tools.handler import BaseHandler from fb_tools.errors import FbAppError, FunctionNotImplementedError from fb_tools.app import BaseApplication @@ -743,7 +744,10 @@ class BaseHookApp(BaseApplication): else: format_str += '%(name)s ' format_str += '%(levelname)s - %(message)s' - formatter = logging.Formatter(format_str) + if not self.is_cgi and self.terminal_has_colors: + formatter = ColoredFormatter(format_str) + else: + formatter = logging.Formatter(format_str) return formatter -- 2.39.5