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.4.0.tar.gz
(84.3 kB
view hashes)
Built Distributions
Logbook-1.4.0-cp35-cp35m-win32.whl
(100.4 kB
view hashes)
Logbook-1.4.0-cp27-cp27m-win32.whl
(101.3 kB
view hashes)
Close
Hashes for Logbook-1.4.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4d0b079756f99181d7d87b701b09af1f5d8b17110fe39465cc7afd94db1e95c |
|
MD5 | 46ba4ddcf718ec37f9cd49494923e634 |
|
BLAKE2b-256 | ce68ca6eaf402cc60180fadc96006fc6aceb1369fdefddcca1481a26180b1402 |
Close
Hashes for Logbook-1.4.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f25f247eed81b7befca3a4646a266c7f6f328a7152d75223f9d3d0ee6476c015 |
|
MD5 | 9dfde1cd20cb3042495a9762646b65a0 |
|
BLAKE2b-256 | 9bb0b49d2f5125a4422dcdd0ff8f9f8f83cc3a5be677d70d6de210cf45ce4773 |
Close
Hashes for Logbook-1.4.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97a827a49db0f543cf67a87dbbb7f3164383c801c28641630e200d00c396baa8 |
|
MD5 | fe0a225b636b9b6f9f0eafb729e4ca50 |
|
BLAKE2b-256 | 2190cfdfe780a813d2aa18f2cb11cd1653f56f75b42377d438fcca6568ca0131 |
Close
Hashes for Logbook-1.4.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e273188067df6c82b09a0b51d1034628fcd2dab300a074c89e64c4dbbbec0328 |
|
MD5 | d3fbd7beb0fce423a1e4bf79e2de240d |
|
BLAKE2b-256 | 6e281f5374ad57e3d2880291f48c4df67daa0f4322a3aae44941fff683b287e3 |