Metadata-Version: 2.1
Name: Logbook
Version: 1.5.3
Summary: A logging replacement for Python
Home-page: http://logbook.pocoo.org/
Author: Armin Ronacher, Georg Brandl
Author-email: armin.ronacher@active-4.com
License: BSD
Platform: any
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
License-File: LICENSE
License-File: AUTHORS
Provides-Extra: test
Requires-Dist: pytest-cov>=2.6; extra == "test"
Requires-Dist: pytest>4.0; extra == "test"
Provides-Extra: dev
Requires-Dist: cython; extra == "dev"
Requires-Dist: pytest-cov>=2.6; extra == "dev"
Requires-Dist: pytest>4.0; extra == "dev"
Provides-Extra: execnet
Requires-Dist: execnet>=1.0.9; extra == "execnet"
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy; extra == "sqlalchemy"
Provides-Extra: redis
Requires-Dist: redis; extra == "redis"
Provides-Extra: zmq
Requires-Dist: pyzmq; extra == "zmq"
Provides-Extra: jinja
Requires-Dist: Jinja2; extra == "jinja"
Provides-Extra: compression
Requires-Dist: brotli; extra == "compression"
Provides-Extra: all
Requires-Dist: sqlalchemy; extra == "all"
Requires-Dist: pytest-cov>=2.6; extra == "all"
Requires-Dist: pytest>4.0; extra == "all"
Requires-Dist: execnet>=1.0.9; extra == "all"
Requires-Dist: pyzmq; extra == "all"
Requires-Dist: cython; extra == "all"
Requires-Dist: Jinja2; extra == "all"
Requires-Dist: brotli; extra == "all"
Requires-Dist: redis; extra == "all"


Logbook
-------

An awesome logging implementation that is fun to use.

Quickstart
``````````

::

    from logbook import Logger
    log = Logger('A Fancy Name')

    log.warn('Logbook is too awesome for most applications')
    log.error("Can't touch this")

Works for web apps too
``````````````````````

::

    from logbook import MailHandler, Processor

    mailhandler = MailHandler(from_addr='servererror@example.com',
                              recipients=['admin@example.com'],
                              level='ERROR', format_string=u'''\
    Subject: Application Error for {record.extra[path]} [{record.extra[method]}]

    Message type:       {record.level_name}
    Location:           {record.filename}:{record.lineno}
    Module:             {record.module}
    Function:           {record.func_name}
    Time:               {record.time:%Y-%m-%d %H:%M:%S}
    Remote IP:          {record.extra[ip]}
    Request:            {record.extra[path]} [{record.extra[method]}]

    Message:

    {record.message}
    ''')

    def handle_request(request):
        def inject_extra(record, handler):
            record.extra['ip'] = request.remote_addr
            record.extra['method'] = request.method
            record.extra['path'] = request.path

        with Processor(inject_extra):
            with mailhandler:
                # execute code that might fail in the context of the
                # request.
