|
|
|
@ -1,25 +1,42 @@
|
|
|
|
|
Flask-Logging-Extras
|
|
|
|
|
====================
|
|
|
|
|
|
|
|
|
|
[travis button] [coveralls button] [pypi button] [documentation button]
|
|
|
|
|
.. image:: https://travis-ci.org/gergelypolonkai/flask-logging-extras.svg?branch=master
|
|
|
|
|
:target: https://travis-ci.org/gergelypolonkai/flask-logging-extras
|
|
|
|
|
|
|
|
|
|
.. image:: https://codecov.io/gh/gergelypolonkai/flask-logging-extras/branch/master/graph/badge.svg
|
|
|
|
|
:target: https://codecov.io/gh/gergelypolonkai/flask-logging-extras
|
|
|
|
|
|
|
|
|
|
.. image:: https://badge.fury.io/py/Flask-Logging-Extras.svg
|
|
|
|
|
:target: https://badge.fury.io/py/Flask-Logging-Extras
|
|
|
|
|
|
|
|
|
|
.. image:: https://readthedocs.org/projects/flask-logging-extras/badge/?version=latest
|
|
|
|
|
:target: http://flask-logging-extras.readthedocs.io/en/latest/?badge=latest
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
string, like this (this example adds the category keyword to the logs:
|
|
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
Installation
|
|
|
|
|
------------
|
|
|
|
|
|
|
|
|
|
pip will be available (hopefully) soon.
|
|
|
|
|
The easiest way to start using the package is with pip:
|
|
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
|
|
$ pip install Flask-Logging-Extras
|
|
|
|
|
|
|
|
|
|
If you prefer to install from source, you can clone this repo and run
|
|
|
|
|
|
|
|
|
@ -30,8 +47,8 @@ If you prefer to install from source, you can clone this repo and run
|
|
|
|
|
Usage
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
|
|
[View the documentation online] (http://flask-jwt-extended.readthedocs.io/en/latest/)
|
|
|
|
|
|
|
|
|
|
`View the documentation online
|
|
|
|
|
<http://flask-logging-extras.readthedocs.io/>`_
|
|
|
|
|
|
|
|
|
|
Testing and Code Coverage
|
|
|
|
|
-------------------------
|
|
|
|
@ -48,15 +65,18 @@ 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 with
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
$ pip install Flask-Sphinx-Themes
|
|
|
|
|
|
|
|
|
|
$ pip install -r docs-requirements.txt
|
|
|
|
|
|
|
|
|
|
Then in the `docs/` directory, run
|
|
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
|
|
$ make clean && make html
|
|
|
|
|
|
|
|
|
|
License
|
|
|
|
|