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.3.0.tar.gz
(84.0 kB
view hashes)
Built Distributions
Logbook-1.3.0-cp36-cp36m-win32.whl
(102.8 kB
view hashes)
Logbook-1.3.0-cp35-cp35m-win32.whl
(101.9 kB
view hashes)
Logbook-1.3.0-cp27-cp27m-win32.whl
(102.8 kB
view hashes)
Close
Hashes for Logbook-1.3.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 744bde9793d4b42cef8b006cf5ab1c052f1cf51b7e782709132eae405ef6d8ef |
|
MD5 | 74728b0891b52b9ebd10f29a1b2a4a56 |
|
BLAKE2b-256 | f4ba1ffc2f0a1f199c68580384d5d20d220a84fae3878e7d3f820d4ed2e766ca |
Close
Hashes for Logbook-1.3.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b91c4305e6127b4879ac6a09e0677dbbd3b2f2ed44737c70ae938cfb3f3bc70c |
|
MD5 | 18f8d0f8f20ec1ea3539d56c69de531c |
|
BLAKE2b-256 | ae96e81960c3fca44ab558fa6c863eb64c0a87c536c7c2966ca1df492603beaf |
Close
Hashes for Logbook-1.3.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55c5f3b4f8d1b65728eba8cb3b525fbac75096d03e2976c1fd12e96cd150e116 |
|
MD5 | ef4964f3ecc9b4526e241e3c8a420f88 |
|
BLAKE2b-256 | f750308ac86e4e60e1dd410d05098f638fe3c01b9348febab37bcbc4b56f9de2 |
Close
Hashes for Logbook-1.3.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 773c6e2977507313f94049b52e624dd5add790b31d0418b73777caea25c41a95 |
|
MD5 | 93a45d31c205498cfb5740d923b67787 |
|
BLAKE2b-256 | 715cb3bf8fe0fd9c9d6b6ce1f557f08abe9ad9fb849507d1ffa67088967929c2 |
Close
Hashes for Logbook-1.3.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2adcb5dce512a4f5a1597a86fbcf9aa2903bcd559c0b73061d35c40349f53ed8 |
|
MD5 | 6c5d1e355fc3c76d811909c35af52c7d |
|
BLAKE2b-256 | 3935f2eef0d3cca071aa7737244a1cf995d7604d3c71ae151b1a7bc09552f883 |
Close
Hashes for Logbook-1.3.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b41bcfe892d5aa66b2b4736f7f0b154fd7561ba439d45a16845e3d6acbd18497 |
|
MD5 | ffdb5b92b0c9ef8d204d209937177546 |
|
BLAKE2b-256 | 96dc69aa77857cbb1c7765f54fb2e84f0f7ec9cdc10197428abd582623566de1 |