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:
parent
1fca3bce13
commit
4d47441fdb
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue