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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Logbook-1.3.3.tar.gz.
File metadata
- Download URL: Logbook-1.3.3.tar.gz
- Upload date:
- Size: 84.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d00abc77735dd22c85925fac9d2cbb21c2eec1839d2e58884975e14d9b351e7c
|
|
| MD5 |
7363061a253e42b176a5e461297ac681
|
|
| BLAKE2b-256 |
300f28ba51875586a292b7dd9d5a095d01d3104a2a4adabe8a92bca331654c4a
|
File details
Details for the file Logbook-1.3.3-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: Logbook-1.3.3-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 108.9 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d9546a6ca0881167cfbe59c356ce6d9106cc14728ed79e25ea7cfa30174f8d7
|
|
| MD5 |
f9c15e3a7a585af475d3a63da4c097a8
|
|
| BLAKE2b-256 |
5c6f6a5d0fad73dfbe7dfb22a9dd1c4825f86b0f0f7462010776788313c3712d
|
File details
Details for the file Logbook-1.3.3-cp36-cp36m-win32.whl.
File metadata
- Download URL: Logbook-1.3.3-cp36-cp36m-win32.whl
- Upload date:
- Size: 100.9 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
affe5ac99aef0a221ff5d76352dc939b5fc370a0653e280acc2d584103ab239c
|
|
| MD5 |
67c1a1f2d8095650067912e06ab2fa83
|
|
| BLAKE2b-256 |
6f934454a957b2e4e13cb94d451594cdf8f83e94284c9462f0943552cd8f34c5
|
File details
Details for the file Logbook-1.3.3-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: Logbook-1.3.3-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 108.4 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c65734ac8b7f2e915805cc5f8c67764b9b5ad905c4f1486820f98719c77c2ba0
|
|
| MD5 |
d09fdab5dd34deb6fd1642bf1795cf2f
|
|
| BLAKE2b-256 |
daad7f6758b94125cb5857db70c86304f19d8ba61066fc690825047585baf0e9
|
File details
Details for the file Logbook-1.3.3-cp35-cp35m-win32.whl.
File metadata
- Download URL: Logbook-1.3.3-cp35-cp35m-win32.whl
- Upload date:
- Size: 100.4 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f8dc0544c2953c9a81d6134dcff9d25fba5d8c6d2f39d20020f29b6982e74a7
|
|
| MD5 |
dfe7321a8851a1f9af0bedba7c5fc005
|
|
| BLAKE2b-256 |
6af854d75e92eb59a77a8b23ac5371438c7eb5b16d39f8a1146ba7ead63feb62
|
File details
Details for the file Logbook-1.3.3-cp27-cp27m-win_amd64.whl.
File metadata
- Download URL: Logbook-1.3.3-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 107.1 kB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4a22f824ac7655b3389487f91875c15b0e3d34cd69472c2c1b86fc804d1c52b
|
|
| MD5 |
e3e9441cbf3c8433d36a9010cae3ef78
|
|
| BLAKE2b-256 |
13713c4903fc0690059b574396e57f3d8bdf2466cd27b0b756bccd56ba7b0110
|
File details
Details for the file Logbook-1.3.3-cp27-cp27m-win32.whl.
File metadata
- Download URL: Logbook-1.3.3-cp27-cp27m-win32.whl
- Upload date:
- Size: 101.3 kB
- Tags: CPython 2.7m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
619b86f98a6cd9aa0a9a6739744f97fa2809b11e79b4850c861a9d7007f4d303
|
|
| MD5 |
fab8bacf235f01fd5f2d4db6bd2e5ff7
|
|
| BLAKE2b-256 |
054a2b22edfce113eb18d01740d3206f6fee34f382d13cf9a1841babe2b2c9c3
|