Last active
August 29, 2015 14:21
-
-
Save theho/eedeb03531b4ef4bef30 to your computer and use it in GitHub Desktop.
Log Formatter for Flask to trim pathname relative to app_root
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
# app is flask app object | |
class FlaskAppFormatter(logging.Formatter): | |
def format(self, record): | |
if record.pathname and record.pathname.startswith(app.root_path): | |
record.pathname = record.pathname.lstrip(app.root_path) | |
return super(FlaskAppFormatter, self).format(record) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment