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.1.tar.gz
(84.1 kB
view hashes)
Built Distributions
Logbook-1.3.1-cp36-cp36m-win32.whl
(100.8 kB
view hashes)
Logbook-1.3.1-cp35-cp35m-win32.whl
(100.3 kB
view hashes)
Logbook-1.3.1-cp27-cp27m-win32.whl
(101.2 kB
view hashes)
Close
Hashes for Logbook-1.3.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83c0d923184fefeee4866fa3e136d9af3e701105b905b7a117ae58702ab63976 |
|
MD5 | 1185243667105175db0b32d332f5f2df |
|
BLAKE2b-256 | dd11a3536da42652bd6e467661072c6746d9c9bc0e2f0eb33dd29efdaa76a7d4 |
Close
Hashes for Logbook-1.3.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f69f8c02a4d1ff57f4ca91449b9be0cc01cc2d4c4abd333282a29378b975806 |
|
MD5 | 30903783c397ffb13f97f0190b2f060e |
|
BLAKE2b-256 | 0ebee1e6885563348317fd560aeda5c9f9a30b2f348be63cdc7627b1836eef89 |
Close
Hashes for Logbook-1.3.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50e8d178f46189e66e05c8dad5cddde8329bd0a4c2ff47fb1132d834644c19e3 |
|
MD5 | 9a7dddec9c35065824988e40952b8797 |
|
BLAKE2b-256 | 93725035fa77bfd34d641e4d79d90b6763ffd159114075e2ce559c1c57d7f6c8 |
Close
Hashes for Logbook-1.3.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a6a82a20a6e18687997084b67a9d17bb5f5f3e8a93c1c6b99c1491888f68de1 |
|
MD5 | 34905712628d62708311b5dcd8fda186 |
|
BLAKE2b-256 | d6cf6f3ff6eb4725897efc1dcebf05760d958b892b8aeb804e993372dff19b13 |
Close
Hashes for Logbook-1.3.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffba4a1f2d699fd58f6b79c4e4792706f73a9ea84ace5c3f8a044f98d2e28d31 |
|
MD5 | d1e3c95610ded91059b95813e6c1a568 |
|
BLAKE2b-256 | 632d32811c2cdcb7283e9340d493acb049a0d42104562395e2bff6e2f043b552 |
Close
Hashes for Logbook-1.3.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d22917f7a179d973d42332fdfba35106fce600e1ac688e05d7feb0c0fd8b3a20 |
|
MD5 | e0cd4d8148596b6c32ebbbaaf716c0f5 |
|
BLAKE2b-256 | 4681c911a6493a8ba8f73e03bb0ac42052f9d8bb50a34223a0b91f050f4abd0c |