Metadata-Version: 2.0
Name: multiline-log-formatter
Version: 0.1.8
Summary: Python logging formatter that prefix multiline log message and trackebacks.
Home-page: https://github.com/peterlauri/python-multiline-log-formatter
Author: Peter Lauri
Author-email: peterlauri@gmail.com
License: BSD
Keywords: logs,logging
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Utilities

========
Overview
========



Python logging formatter that prefix multiline log message and trackebacks. Makes the logs more readable, both for
tracebacks and for multiline log messages.

* Free software: BSD license

Benchmarking
============

Benchmark against pythons built in formatter **logging.Formatter**. The benchmark is done using **pytest-benchmark**,
and the below results is from a run on a faily new MacBook Pro, using Python 2.7.

One should note that we are using StringIO as stream output, so we should expect the results to be even closer with
more production alike setup, for example writing to disc.

.. image:: https://raw.github.com/peterlauri/python-multiline-log-formatter/master/docs/benchmark.png
    :alt: python-redis-lock flow diagram

Installation
============

.. code-block:: bash

    pip install multiline-log-formatter

Usage
=====

Add this to dictConfig:

.. code-block:: python

    'formatters': {
        'default': {
            '()': 'multiline_formatter.formatter.MultilineMessagesFormatter',
            'format': '[%(levelname)s] %(message)s'
        },
    },

And log messages will look like this:

.. code-block:: bash

    [ERROR] LOGGING_MESSAGE ... (49564:MainThread)
    ... (49564:MainThread) : Traceback (most recent call last):
    ... (49564:MainThread) :   File "/Users/plauri/work/opensource/python-multiline-log-formatter/tests/test_multiline_formatter.py", line 112, in test_exception
    ... (49564:MainThread) :     raise Exception('EXCEPTION_MESSAGE')
    ... (49564:MainThread) : Exception: EXCEPTION_MESSAGE

And if you don't like the default, you can customize it by extending **MultilineMessagesFormatter** and set
**multiline_marker**. You can also change **multiline_fmt**, but assure you include **%(message)s** in the formating
string.

Documentation
=============

https://python-multiline-log-formatter.readthedocs.org/

Development
===========

To run the all tests run::

    tox


Other
=====

This project sceleton is generated by ionelmc's pylibrary_ cookiecutter.

.. _pylibrary: https://github.com/ionelmc/cookiecutter-pylibrary



Changelog
=========

0.1.0 (2016-01-14)
-----------------------------------------

* First release on PyPI.


