Extra logging functionality for Flask applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Gergely Polonkai dbe822a02c
Update README
6 years ago
docs Update documentation, and a bit of the functionality 6 years ago
flask_logging_extras Finalize the extra-keyword logging feature 6 years ago
tests Create tests 6 years ago
.gitignore Add tox configuration 6 years ago
.travis.yml Remove Python 3.6 from Tox configuration 6 years ago
README.rst Update README 6 years ago
docs-requirements.txt Add requirements file for documentation generating 6 years ago
setup.py Add a setup.py file 6 years ago
tox.ini Add tox configuration 6 years ago

README.rst

Flask-Logging-Extras

image

image

image

image

Flask-Logging-Extras adds additional logging features for Flask applications.

The only feature implemented now is adding extra arguments to the format string, like this (this example adds the category keyword to the logs:

fmt = '[%(asctime)s] [%(levelname)s] [%(category)s] %(message'
# Initialize log handlers as usual, like creating a FileHandler, and
# assign fmt to it as a format string
app.config['FLASK_LOGGING_EXTRAS_KEYWORDS'] = {'category': '<unset>'}
app.logger.init_app(app)

current_app.logger.info('this is the message, as usual',
                        category='fancy-category')

Installation

The easiest way to start using the package is with pip:

$ pip install Flask-Logging-Extras

If you prefer to install from source, you can clone this repo and run

$ python setup.py install

Usage

View the documentation online

Testing and Code Coverage

We require 100% code coverage in our unit tests. We run all the unit tests with tox, which will test against python2.7, 3.3, 3.4, and 3.5.

Running tox will print out a code coverage report. Coverage report is also available on codecov.

tox is running automatically for every push in Travis-CI. To run tox on your local machine, you can simply invoke it with the tox command.

Generating Documentation

You can generate a local copy of the documentation. First, make sure you have the flask sphinx theme available. You can get it (and all possible documentation requirements) with

$ pip install -r docs-requirements.txt

Then in the docs/ directory, run

$ make clean && make html

License

This module is available under the BSD license.