skip to navigation
skip to content

Logbook 0.12.3

A logging replacement for Python

Package Documentation

An awesome logging implementation that is fun to use.


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='',
                          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]}]



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.
File Type Py Version Uploaded on Size
Logbook-0.12.3-cp26-none-win32.whl (md5) Python Wheel cp26 2015-11-24 82KB
Logbook-0.12.3-cp26-none-win_amd64.whl (md5) Python Wheel cp26 2015-11-24 85KB
Logbook-0.12.3-cp27-none-win32.whl (md5) Python Wheel cp27 2015-11-24 82KB
Logbook-0.12.3-cp27-none-win_amd64.whl (md5) Python Wheel cp27 2015-11-24 85KB
Logbook-0.12.3-cp33-none-win32.whl (md5) Python Wheel cp33 2015-11-24 83KB
Logbook-0.12.3-cp33-none-win_amd64.whl (md5) Python Wheel cp33 2015-11-24 85KB
Logbook-0.12.3-cp34-none-win32.whl (md5) Python Wheel cp34 2015-11-24 83KB
Logbook-0.12.3-cp34-none-win_amd64.whl (md5) Python Wheel cp34 2015-11-24 85KB
Logbook-0.12.3-cp35-none-win32.whl (md5) Python Wheel cp35 2015-11-24 83KB
Logbook-0.12.3-cp35-none-win_amd64.whl (md5) Python Wheel cp35 2015-11-24 86KB
Logbook-0.12.3-py2.6-linux-x86_64.egg (md5) Python Egg 2.6 2015-11-24 251KB
Logbook-0.12.3-py2.7-linux-x86_64.egg (md5) Python Egg 2.7 2015-11-24 252KB
Logbook-0.12.3-py3.2-linux-x86_64.egg (md5) Python Egg 3.2 2015-11-24 261KB
Logbook-0.12.3-py3.3-linux-x86_64.egg (md5) Python Egg 3.3 2015-11-24 265KB
Logbook-0.12.3-py3.4-linux-x86_64.egg (md5) Python Egg 3.4 2015-11-24 276KB
Logbook-0.12.3-py3.5-linux-x86_64.egg (md5) Python Egg 3.5 2015-11-24 275KB
Logbook-0.12.3.tar.gz (md5) Source 2015-11-24 160KB
  • Downloads (All Versions):
  • 5526 downloads in the last day
  • 35290 downloads in the last week
  • 141714 downloads in the last month