diff --git a/upnpavcontrol/web/application.py b/upnpavcontrol/web/application.py index 09996df6..bcf00f17 100644 --- a/upnpavcontrol/web/application.py +++ b/upnpavcontrol/web/application.py @@ -71,12 +71,9 @@ def create_control_point_from_settings(): @app.on_event("startup") def setup_logging(): - import colorlog import logging level = logging.WARNING if settings.QUIET else logging.INFO level = logging.DEBUG if settings.DEBUG else level - colorlog.basicConfig(level=level, - format='%(log_color)s%(levelname)s%(reset)s:%(yellow)s%(name)s%(reset)s: %(message)s') logging.getLogger('async_upnp_client').setLevel(logging.INFO) diff --git a/uvicorn-log-config.yml b/uvicorn-log-config.yml index 7789acbe..58f1154f 100644 --- a/uvicorn-log-config.yml +++ b/uvicorn-log-config.yml @@ -1,16 +1,23 @@ version: 1 formatters: - simple: - format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' + color: + "()": "colorlog.ColoredFormatter" + format: '%(asctime)s %(log_color)s%(levelname)s%(reset)s %(yellow)s%(name)-15s%(reset)s %(blue)s%(message)s%(reset)s' + datefmt: '%Y-%m-%d %H:%M:%S' + default: + format: '%(asctime)s %(levelname)-8s %(name)-15s %(message)s' + datefmt: '%Y-%m-%d %H:%M:%S' handlers: console: class: logging.StreamHandler level: DEBUG - formatter: simple + formatter: color stream: ext://sys.stdout loggers: upnpavcontrol: level: DEBUG + upnpavcontrol.core.discovery: + level: WARNING root: level: INFO handlers: [console] \ No newline at end of file