Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Simple logging decorator for Flask.

Project description


Build Status

This is a deadly simple logging decorator for Flask. This is highly inspired by canassa/flask-trace.


This is tested with Python3.5, 3.6 and Flask1.0.2.


pip install flask-logging-decorator

Run the test

This modules uses pytest. You can install it before running the test.

python -m pytest -v


Import and put it as the decorator function.

import logging

from flask_logging_decorator import trace
from flask import Flask

app = Flask(__name__)

def index():
    return 'hello'


The application should show the logging message like following.

[2018-05-17 19:01:31,468] ERROR in __init__: trace_uuid=cf66d343-06f4-49cb-a680-59ba9ec77570 method=GET func_name=index func_args: query_args:foo='bar' baz='qux' post_values: trace_lineno=12

If you don't pass the logging level to @trace, it will use the Flask's application logger.


MIT license, see the LICENSE file. You can use this library in open source projects and commercial products.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flask-logging-decorator, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size flask_logging_decorator-0.0.5-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size flask_logging_decorator-0.0.5.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page