Created
January 7, 2016 23:54
-
-
Save tachyondecay/bf1f283468a724b88f30 to your computer and use it in GitHub Desktop.
Logging for Flask app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logging_config = { | |
"version": 1, | |
"disable_existing_loggers": False, | |
"formatters": { | |
"simple": { | |
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s" | |
} | |
}, | |
"handlers": { | |
"console": { | |
"class": 'logging.StreamHandler', | |
"level": "DEBUG", | |
"formatter": "simple", | |
"stream": "ext://sys.stdout" | |
}, | |
"info_file_handler": { | |
"class": 'logging.handlers.TimedRotatingFileHandler', | |
"level": "INFO", | |
"formatter": "simple", | |
"filename": "info.log", | |
"when": "D", | |
"interval": 7, | |
"backupCount": 6, | |
"encoding": "utf8" | |
}, | |
"error_file_handler": { | |
"class": 'logging.handlers.TimedRotatingFileHandler', | |
"level": "ERROR", | |
"formatter": "simple", | |
"filename": "errors.log", | |
"when": "D", | |
"interval": 7, | |
"backupCount": 6, | |
"encoding": "utf8" | |
} | |
}, | |
"root": { | |
"level": "INFO", | |
"handlers": ["console", "info_file_handler", "error_file_handler"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment