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.
This commit is contained in:
Kumi 2024-08-27 13:46:17 +02:00
parent 1fca3bce13
commit 4d47441fdb
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -27,6 +27,9 @@ handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG) handler.setLevel(logging.DEBUG)
logger.addHandler(handler) 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") formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
handler.setFormatter(formatter) handler.setFormatter(formatter)