Skip to content

Instantly share code, notes, and snippets.

@theho
Last active August 29, 2015 14:21
Show Gist options
  • Save theho/eedeb03531b4ef4bef30 to your computer and use it in GitHub Desktop.
Save theho/eedeb03531b4ef4bef30 to your computer and use it in GitHub Desktop.
Log Formatter for Flask to trim pathname relative to app_root
# 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