Skip to main content

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.

Metadata

Release files for Logbook 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Logbook 1.4.0
File Size Uploaded Provenance Actions
Logbook-1.4.0.tar.gz 84.3 kB Without provenance Details for Logbook-1.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for Logbook 1.4.0
File Actions
Logbook-1.4.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for Logbook-1.4.0-cp36-cp36m-win_amd64.whl
Logbook-1.4.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details for Logbook-1.4.0-cp35-cp35m-win_amd64.whl
Logbook-1.4.0-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details for Logbook-1.4.0-cp35-cp35m-win32.whl
Logbook-1.4.0-cp27-cp27m-win32.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-32 Details for Logbook-1.4.0-cp27-cp27m-win32.whl

Total release size: 503.5 kB

Release files / Logbook-1.4.0.tar.gz

Download URL Logbook-1.4.0.tar.gz
Size 84.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3c0a3ebd48e89fcdd725fe393eb9226c789dca5a4e7842d65e2f256645fd1cd9
BLAKE2b-256 checksum
How to use checksums
364bb610bee18d5cfc4cec7dde056639994e9b34991e4c57816bfff0f3d0ac33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Logbook-1.4.0-cp36-cp36m-win_amd64.whl

Download URL Logbook-1.4.0-cp36-cp36m-win_amd64.whl
Size 109.0 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
f4d0b079756f99181d7d87b701b09af1f5d8b17110fe39465cc7afd94db1e95c
BLAKE2b-256 checksum
How to use checksums
ce68ca6eaf402cc60180fadc96006fc6aceb1369fdefddcca1481a26180b1402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Logbook-1.4.0-cp35-cp35m-win_amd64.whl

Download URL Logbook-1.4.0-cp35-cp35m-win_amd64.whl
Size 108.5 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
f25f247eed81b7befca3a4646a266c7f6f328a7152d75223f9d3d0ee6476c015
BLAKE2b-256 checksum
How to use checksums
9bb0b49d2f5125a4422dcdd0ff8f9f8f83cc3a5be677d70d6de210cf45ce4773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Logbook-1.4.0-cp35-cp35m-win32.whl

Download URL Logbook-1.4.0-cp35-cp35m-win32.whl
Size 100.4 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
97a827a49db0f543cf67a87dbbb7f3164383c801c28641630e200d00c396baa8
BLAKE2b-256 checksum
How to use checksums
2190cfdfe780a813d2aa18f2cb11cd1653f56f75b42377d438fcca6568ca0131
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Logbook-1.4.0-cp27-cp27m-win32.whl

Download URL Logbook-1.4.0-cp27-cp27m-win32.whl
Size 101.3 kB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
e273188067df6c82b09a0b51d1034628fcd2dab300a074c89e64c4dbbbec0328
BLAKE2b-256 checksum
How to use checksums
6e281f5374ad57e3d2880291f48c4df67daa0f4322a3aae44941fff683b287e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Logbook 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4.0 This release

5 release files No provenance

0.12.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page