From 4d47441fdbedce26da7eb3758001c62a287389d3 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 27 Aug 2024 13:46:17 +0200 Subject: [PATCH] fix(logging): remove default Flask logger Removed the default Flask logger to prevent duplicate logging entries. Refined log output by adding a custom handler and formatter to ensure logs are consistent and properly formatted. --- src/wikimore/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wikimore/app.py b/src/wikimore/app.py index 45388b5..afd1a37 100644 --- a/src/wikimore/app.py +++ b/src/wikimore/app.py @@ -27,6 +27,9 @@ handler = logging.StreamHandler() handler.setLevel(logging.DEBUG) logger.addHandler(handler) +# Remove the default Flask logger +app.logger.removeHandler(app.logger.handlers[0]) + formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") handler.setFormatter(formatter)