From: Frank Brehm Date: Mon, 7 Jan 2019 15:00:03 +0000 (+0100) Subject: Changing init logging X-Git-Tag: 1.6.4^2~65 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=7218585ef83f880b653dc73bf4a0844b1fcd0730;p=pixelpark%2Fpuppetmaster-webhooks.git Changing init logging --- 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