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
Logbook-1.2.1.tar.gz
(83.3 kB
view hashes)
Built Distributions
Logbook-1.2.1-cp36-cp36m-win32.whl
(102.4 kB
view hashes)
Logbook-1.2.1-cp35-cp35m-win32.whl
(101.5 kB
view hashes)
Logbook-1.2.1-cp27-cp27m-win32.whl
(102.4 kB
view hashes)
Close
Hashes for Logbook-1.2.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b6da02a51cace9e851b05789cc841d39dec33c8b083ce727bf061fac1611c06 |
|
MD5 | 26b0dcef2d8b91470a3e7304d5a7f7df |
|
BLAKE2b-256 | 4b5457c1084b937af37e5d39554c234cce2fa528d5b223bed04ed0f6ed38d240 |
Close
Hashes for Logbook-1.2.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ef1857de50bb6e70b1e4ef034f1c032d37577ce9eb70e164974a0ae8177b537 |
|
MD5 | 059f0dd40070e9e539d3dd3676216af6 |
|
BLAKE2b-256 | 2713725fe0a0194a26843277311f37306eb332a69e8b121d8027e1afd62c4cfe |
Close
Hashes for Logbook-1.2.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc345cef7b58f745da01feee461f6941d08260026b41586a77f5112c12355488 |
|
MD5 | a03e1462c9c332e20e869aa0145e1de0 |
|
BLAKE2b-256 | 388981e25dfdaeee54a482f9d5e024ec0ded8b7a5a7bcd8e398a4480e7a8b79f |
Close
Hashes for Logbook-1.2.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 969161f46d5562e041f4d01cdf413114fe8012038e7d69052dff6b1f0ba2803d |
|
MD5 | 8ff0142b930cbbea673f48dee9ada6b9 |
|
BLAKE2b-256 | 8e0702fc948335286bd34a36c6e3676d3d18238f92390c55527b6a8be2e150d1 |
Close
Hashes for Logbook-1.2.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 645e50279e0e8121a5f622cf640a9d83fc0e0f1b78b29e01cf5e13e487b9f6fb |
|
MD5 | a804c786023dfb3faf4790d6bbe0860b |
|
BLAKE2b-256 | 54342bf3678483da77ecb2beee4d8c6e24ac54be003bf31816eae1b8a9076dec |
Close
Hashes for Logbook-1.2.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe205ca51aa004ee83a0218e40a214308b6723b2186c7f04f134f94410286aae |
|
MD5 | 75ee14157bb30ca5e9ffd635fbeea4a5 |
|
BLAKE2b-256 | bd8c15d9374d80225e0f5f4ac3ea98f6f88d37bffecd583bf86ff7b7665afb7e |