From c1ae8e6a4b00c7f68c0078a7936707ef3ddb2c59 Mon Sep 17 00:00:00 2001 From: Francisco Schulz Date: Wed, 15 Feb 2023 15:44:56 +0100 Subject: [PATCH] add log config to `__init__.py` --- image_prediction/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/image_prediction/__init__.py b/image_prediction/__init__.py index e69de29..315dcb1 100644 --- a/image_prediction/__init__.py +++ b/image_prediction/__init__.py @@ -0,0 +1,13 @@ +import logging +import sys + +# log config +LOG_FORMAT = "%(asctime)s [%(levelname)s] - [%(filename)s -> %(funcName)s() -> %(lineno)s] : %(message)s" +DATE_FORMAT = "%Y-%m-%d %H:%M:%S" +stream_handler = logging.StreamHandler(sys.stdout) +stream_handler_format = logging.Formatter(LOG_FORMAT, datefmt=DATE_FORMAT) +stream_handler.setFormatter(stream_handler_format) + +logger = logging.getLogger(__name__) +logger.propagate = False +logger.addHandler(stream_handler)