Skip to main content

A logging replacement for Python

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Logbook-1.0.0.tar.gz (178.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

Logbook-1.0.0-cp35-cp35m-win_amd64.whl (93.8 kB view details)

Uploaded CPython 3.5mWindows x86-64

Logbook-1.0.0-cp35-cp35m-win32.whl (89.4 kB view details)

Uploaded CPython 3.5mWindows x86

Logbook-1.0.0-cp34-cp34m-win_amd64.whl (93.1 kB view details)

Uploaded CPython 3.4mWindows x86-64

Logbook-1.0.0-cp34-cp34m-win32.whl (89.9 kB view details)

Uploaded CPython 3.4mWindows x86

Logbook-1.0.0-cp33-cp33m-win_amd64.whl (93.1 kB view details)

Uploaded CPython 3.3mWindows x86-64

Logbook-1.0.0-cp33-cp33m-win32.whl (89.9 kB view details)

Uploaded CPython 3.3mWindows x86

Logbook-1.0.0-cp27-cp27m-win_amd64.whl (92.5 kB view details)

Uploaded CPython 2.7mWindows x86-64

Logbook-1.0.0-cp27-cp27m-win32.whl (89.3 kB view details)

Uploaded CPython 2.7mWindows x86

Logbook-1.0.0-cp26-cp26m-win_amd64.whl (92.7 kB view details)

Uploaded CPython 2.6mWindows x86-64

Logbook-1.0.0-cp26-cp26m-win32.whl (89.5 kB view details)

Uploaded CPython 2.6mWindows x86

File details

Details for the file Logbook-1.0.0.tar.gz.

File metadata

  • Download URL: Logbook-1.0.0.tar.gz
  • Upload date:
  • Size: 178.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Logbook-1.0.0.tar.gz
Algorithm Hash digest
SHA256 87da2515a6b3db866283cb9d4e5a6ec44e52a1d556ebb2ea3b6e7e704b5f1872
MD5 22fea705e067c118925898f0c30b0508
BLAKE2b-256 34e86419c217bbf464fe8a902418120cccaf476201bd03b50958db24d6e90f65

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 e9fccf7d8afa683a513f624dbdee3cfe5c25a5480d15aeb51b49f5de6748cb6f
MD5 34e9b823dad207cfd4a34acba2972bab
BLAKE2b-256 8b14111a25688ddc5ac66e16c42e5c254cbd4720347921bf718cba11d7d995bf

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 c4745d0bf13f3c597ded4fc8823c04f95b0844511752a4e29576673636adeb29
MD5 074b4bf73d51ce4d4f9f051bc6caedb9
BLAKE2b-256 b6113de5cf3d54aba3dbccfcf7f375cd7da680853b9e7aef1d67bc698bbe8df2

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 893846917686478046843d381a623dabf059133f333064b05571e62dba9c8222
MD5 06c1187c720b9638eca70d1608e7a9a4
BLAKE2b-256 a64e53652e2420ef5bbf920eea7167452e8c91a2bd7f2a734239dc3e10280b74

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 8ff47108ed32a7e3f3a0f0b4b26a8dbe6df10bf4108d94bd81bfd7a3645dff7f
MD5 4ba63f26091f892a378aba84e3083996
BLAKE2b-256 12b51e47ba23d08f5f24d0fb0c5e4bfc612f70291c90a0b10313cd6a110bea94

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp33-cp33m-win_amd64.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp33-cp33m-win_amd64.whl
Algorithm Hash digest
SHA256 ce33c6cd1f76d80e06203c0ed5b7dbf27a5504c8ba043eb860c2160ad483338b
MD5 92e66fbde691cd8d6b22541fbfd07fc8
BLAKE2b-256 b2e63b086079a93a3a23ac734de58c9613e78c67d3b1af70154ca7557a83f7ad

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp33-cp33m-win32.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp33-cp33m-win32.whl
Algorithm Hash digest
SHA256 dd8aed42845d005a9b680e2341ff040bcd3855295e673241ff51c8bae4902a9b
MD5 10ead406e321e860f066d01c49e77a31
BLAKE2b-256 13618d3189c91c6449549abece5fe7223be9389a2066046461e30c9a82e005e5

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 0f87d372c69e06b4136713126713c1abf5ce8e6c7c977bc325d7b1608c8f5627
MD5 e76d129a1dcd76a64bb0bcce20a49ce2
BLAKE2b-256 52af4f28c6b45944d3390522b4e11da073db9ed4980bf874fc6635f8766cf737

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 72fb1656849b9ba0c57dcaa1b14da56a252fc2b12311f1d8a6e0a55a2d17ffaa
MD5 053c1d2e373b84d684e044b1fd378619
BLAKE2b-256 5aeee61f941d4eba6115fc71ee1e96e99f7585fcdc9d72cf28312958f242596c

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp26-cp26m-win_amd64.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp26-cp26m-win_amd64.whl
Algorithm Hash digest
SHA256 012cf121dd0e7474289c4612a41a6ad39f694bf389dd0e4ed4e4e8743aa0a720
MD5 c80fd0a7ee17b660ade787d8b70a1fb1
BLAKE2b-256 409b8a0736e6947108659e32dbbdd513eac787f9c1c10bf9852da5d9be700df1

See more details on using hashes here.

File details

Details for the file Logbook-1.0.0-cp26-cp26m-win32.whl.

File metadata

File hashes

Hashes for Logbook-1.0.0-cp26-cp26m-win32.whl
Algorithm Hash digest
SHA256 8504e2a180e638b14b177ba3f9bf8a85759b7fac4d660ddb917d87cc7bfde8da
MD5 ed1f27edaf69bc6cbc7ff958683d91be
BLAKE2b-256 9d278aed3933efa935238abd9eaf9a4b0b77b087847962435de33a65c0a75c9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page