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.1.0.tar.gz (186.7 kB view details)

Uploaded Source

Built Distributions

Logbook-1.1.0-cp36-cp36m-win_amd64.whl (96.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

Logbook-1.1.0-cp36-cp36m-win32.whl (91.7 kB view details)

Uploaded CPython 3.6mWindows x86

Logbook-1.1.0-cp35-cp35m-win_amd64.whl (96.6 kB view details)

Uploaded CPython 3.5mWindows x86-64

Logbook-1.1.0-cp35-cp35m-win32.whl (91.3 kB view details)

Uploaded CPython 3.5mWindows x86

Logbook-1.1.0-cp34-cp34m-win_amd64.whl (94.9 kB view details)

Uploaded CPython 3.4mWindows x86-64

Logbook-1.1.0-cp34-cp34m-win32.whl (91.5 kB view details)

Uploaded CPython 3.4mWindows x86

Logbook-1.1.0-cp33-cp33m-win_amd64.whl (94.9 kB view details)

Uploaded CPython 3.3mWindows x86-64

Logbook-1.1.0-cp33-cp33m-win32.whl (91.4 kB view details)

Uploaded CPython 3.3mWindows x86

Logbook-1.1.0-cp27-cp27m-win_amd64.whl (94.0 kB view details)

Uploaded CPython 2.7mWindows x86-64

Logbook-1.1.0-cp27-cp27m-win32.whl (91.2 kB view details)

Uploaded CPython 2.7mWindows x86

File details

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

File metadata

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

File hashes

Hashes for Logbook-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0e37a18f4f8244b02a1c44cfd2a3bab9513e6e22b67986ab6a91d52b87f0940b
MD5 f3cc2d35fb41b19e05922d3f257c832d
BLAKE2b-256 a2d1b5d12094f5a5b8f456198991c44b56faf72411e58dc166e71593ff2febea

See more details on using hashes here.

File details

Details for the file Logbook-1.1.0-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for Logbook-1.1.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 9f68a6f87234798417130efab7e190ee5dc7e8ced500f82cd200bfa15e9b6987
MD5 7e1158f28525fd921428b8b9ecaedcb7
BLAKE2b-256 bd988c12e8ba83d03dd4325032d64e6b35a8d19e0d8f681055dc387a7eae7b6e

See more details on using hashes here.

File details

Details for the file Logbook-1.1.0-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for Logbook-1.1.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 ef1397e6e82d8cbe3667c743f46144ccb252eca3173e4fc78e3afbe500e61c17
MD5 e430bde4225c19f8f45fc9dd235d7bb0
BLAKE2b-256 236e2a195223d8a3b0c80c24dfac4a489cdbfbf009d386c20b9c7bcaff58a6d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 1ac26372b97a9d93be13968a30bcc110610960b688c5164a2890a75b3ad6668f
MD5 61e417e830a1e09cfcb49fc6330f485c
BLAKE2b-256 6c66f06b8e8d1acaa4bb36540bea0bc3ecb42b3741168f3eff1e94cedd694111

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 66d8cf296edbb64a68a47762f2cf78da7d70690c0a54ce7fbdeec1325db3306e
MD5 1368c71f3b6a99dca95767f349996283
BLAKE2b-256 cc7280557b5754e48f6baf63d03358d7848c35f3efcd7b0bc613f24b7104508a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 9615ff1c55fe7632d6909eb01b97d64b323077323f1a5d6e4b657180e0bc1e6e
MD5 9b106323bd18af22c7718272a6d65c13
BLAKE2b-256 211ad2812b126faff53fbd5f17e8fcf3faf07bb1598935d1df5367cc1a4dd3ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 dcd4a2fa711a5fb4fa9792629ca3c2c3d03ead50c8c181371352bb273a0ab3a9
MD5 52024955e9fb4da48389dd62cb4ab263
BLAKE2b-256 c7f87beb89c760225033aacca5166eaa1b1a910ed1f8dd05fbeea79e0f713f29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp33-cp33m-win_amd64.whl
Algorithm Hash digest
SHA256 b42b6dd6caf9fa9ed69d074659584aaa36f2617ddc1217bfb25c8a3f77e109e8
MD5 4b94c5ee2910262a54d95c56960c4d2a
BLAKE2b-256 ecdce9f845a358ef45dd4d55382a9d68ecf9c97d030ad58e4ee1a61dca523bbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp33-cp33m-win32.whl
Algorithm Hash digest
SHA256 49b39ff2db6950a8e8bed2ae21e4418ee89d7a2d13b6b687ef346a9d39a517a8
MD5 993b5d54f3b929df630f7d6677413e26
BLAKE2b-256 ed740e2cf705dce1292b719bb64b604a4d50983eb3a9ae7bb4fc2280570de0ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 82206c17d08cb5aa47655b51f735b6dd5a62543c13154bdca8eb6fc5d720022e
MD5 3d6a67bb1de66817f6087d561be1557a
BLAKE2b-256 05d5f6abad76d4c12c4f7a3ca93fd90e0453162d0c26b8c23d94719e758c0fff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Logbook-1.1.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 f37048f33600bb836b4a840cedb216ee52417d98d47f80a237669841310a4d6f
MD5 59502bd69e7411eb7593913d81a79417
BLAKE2b-256 f93a5bddfb5a24b68fabc60bdd0eff8f028b0e7f26416cbe486c1770571df1d8

See more details on using hashes here.

Supported by

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