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.1.tar.gz
(84.6 kB
view hashes)
Built Distributions
Logbook-1.4.1-cp36-cp36m-win32.whl
(102.5 kB
view hashes)
Logbook-1.4.1-cp35-cp35m-win32.whl
(102.0 kB
view hashes)
Logbook-1.4.1-cp27-cp27m-win32.whl
(102.9 kB
view hashes)
Close
Hashes for Logbook-1.4.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6ee2eb8c169595a0101fc72f8a5d2585db2ec0562a856b02be19f5ccf426e46 |
|
MD5 | 3917ead50764e237e638ce7214bbb199 |
|
BLAKE2b-256 | 59b5ee8083c4376911d240020984a5f4dd3f9b6187fc4e79ba24ea49ff7d15b9 |
Close
Hashes for Logbook-1.4.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef2e03f6144fa9aa64b8ff69678e2206f7d6788d630156737f6d66e1b2c1d319 |
|
MD5 | 31e77fae018c154e559467d5a9740086 |
|
BLAKE2b-256 | 1a12563d8a29ce57cef03b8b608ba4a9cc5f3debe8746ed2b37ff89206ab180a |
Close
Hashes for Logbook-1.4.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69b461abadb1582b72eeb0db1429545d8f9fc373c3421738f31df1956ac111b2 |
|
MD5 | d95b8d3371c68303aca912b9a406dba8 |
|
BLAKE2b-256 | 840153c8c78f70f8d53bc41c909333241e0cfb0d39b1d27c06c01170ebbcdc66 |
Close
Hashes for Logbook-1.4.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a8f9c583d7247b6f9bea7945d1d1a1bcc516b78f0e2376942201f2283191a08 |
|
MD5 | 6e2f27e6b5d6e0b03750cca1d1ff451d |
|
BLAKE2b-256 | 9fde86adf27160295a0f583ea34c4f0cf255e11ba19efb5c75a591336eff565c |
Close
Hashes for Logbook-1.4.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d07e4a01cfa03cfec83ad19044d122981788c88605f4d0295d56667746ee2a74 |
|
MD5 | 78639b80e0ba5f2118d23eaabb8a6362 |
|
BLAKE2b-256 | 4f5422673eed6809f749186e2654018efcd796d4b336e8c5c07a91ddff69bde4 |
Close
Hashes for Logbook-1.4.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78008531bca8105aae4c5a03338c4627eebbe3737bd57ab7e8ba09f134609ed5 |
|
MD5 | 1aaaf7316693d4a2210e2b0b835c52e9 |
|
BLAKE2b-256 | 47553a0331c88d1bc00cc58b59d8aa0891224c7337809daa8c95fecec9b79acb |