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

Uploaded Source

Built Distributions

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

Logbook-0.12.2-py3.5-linux-x86_64.egg (282.6 kB view details)

Uploaded Egg

Logbook-0.12.2-py3.4-linux-x86_64.egg (282.7 kB view details)

Uploaded Egg

Logbook-0.12.2-py3.3-linux-x86_64.egg (271.8 kB view details)

Uploaded Egg

Logbook-0.12.2-py3.2-linux-x86_64.egg (267.5 kB view details)

Uploaded Egg

Logbook-0.12.2-py2.7-linux-x86_64.egg (258.4 kB view details)

Uploaded Egg

Logbook-0.12.2-py2.6-linux-x86_64.egg (258.0 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for Logbook-0.12.2.tar.gz
Algorithm Hash digest
SHA256 b9f3ca6bebd00f7cecb6de30c0e561f36cabc2ef6241aab4629beca4e9e8dea9
MD5 aec29d6ea167f9d4e7edcb951a24c86c
BLAKE2b-256 5db03f8ca5f9a9f268acdfefb484081b340eee0844a60b89fa763e6457839586

See more details on using hashes here.

File details

Details for the file Logbook-0.12.2-py3.5-linux-x86_64.egg.

File metadata

File hashes

Hashes for Logbook-0.12.2-py3.5-linux-x86_64.egg
Algorithm Hash digest
SHA256 a8040972371120ce7d8e1d10d91c4c81fa4eaae728728e897cfb45daa592ed02
MD5 5369811ee064ac853827e0bad0be7829
BLAKE2b-256 0f4892806f0c68144e09b04b6c287ce6936f9fad8ed081f08b090f749f7f57a0

See more details on using hashes here.

File details

Details for the file Logbook-0.12.2-py3.4-linux-x86_64.egg.

File metadata

File hashes

Hashes for Logbook-0.12.2-py3.4-linux-x86_64.egg
Algorithm Hash digest
SHA256 25e93b5243194a5f3650b0702e13afc22eb6b73a7abb09eee2e6cc29befcc265
MD5 3081308dbc30534a67059be1e551e9bd
BLAKE2b-256 995036ec99330ac7eca63be1bdd6f798c9a85dc1333599b957e563b4cef94bc1

See more details on using hashes here.

File details

Details for the file Logbook-0.12.2-py3.3-linux-x86_64.egg.

File metadata

File hashes

Hashes for Logbook-0.12.2-py3.3-linux-x86_64.egg
Algorithm Hash digest
SHA256 cdc6a7ac373c2f5ed30b6c29a48f055cf473bafb37c64c5abc6078e4801b5827
MD5 c14a889beff1593940e1d7de05d8a1a7
BLAKE2b-256 c6ee14317af67666b682d2d9335ee51f53fb5b286986eaea876ea1406bdef195

See more details on using hashes here.

File details

Details for the file Logbook-0.12.2-py3.2-linux-x86_64.egg.

File metadata

File hashes

Hashes for Logbook-0.12.2-py3.2-linux-x86_64.egg
Algorithm Hash digest
SHA256 45df6f5a9b3b7467f9e29b9c4b7148b174213beb9d2c45fe8b367ea3b4a93c02
MD5 5e4d00c287967dc530be37de79aa14f0
BLAKE2b-256 f5d5d7e203520a413ece1d3212a0fff80045028a6a1312e8ef9e39ca47e22e5c

See more details on using hashes here.

File details

Details for the file Logbook-0.12.2-py2.7-linux-x86_64.egg.

File metadata

File hashes

Hashes for Logbook-0.12.2-py2.7-linux-x86_64.egg
Algorithm Hash digest
SHA256 14dade9ed8c217daf2dee92f8b82d7c58c5a0d0b3df93a2702d715c05fdeeeaf
MD5 3725bd534e9de60edeaa7dfe57dda5f8
BLAKE2b-256 081a1044edfc2497b521d7240b8241f24ab285b7f27407318a1f207299d9b73e

See more details on using hashes here.

File details

Details for the file Logbook-0.12.2-py2.6-linux-x86_64.egg.

File metadata

File hashes

Hashes for Logbook-0.12.2-py2.6-linux-x86_64.egg
Algorithm Hash digest
SHA256 e291c30c2c3d3721c6a20eef4903e5406c9ef4c0ee37e68f6f3ed61b2d6ddece
MD5 859fae4b9fb2a7fad9765a2b5c2f6082
BLAKE2b-256 2208ed6b1e8a0081821d8fb5ff5061f69e21d96b441c25efc904e88b8d85d393

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