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.2.tar.gz
(83.4 kB
view hashes)
Built Distributions
Logbook-1.2.2-cp36-cp36m-win32.whl
(102.4 kB
view hashes)
Logbook-1.2.2-cp35-cp35m-win32.whl
(101.5 kB
view hashes)
Logbook-1.2.2-cp27-cp27m-win32.whl
(102.4 kB
view hashes)
Close
Hashes for Logbook-1.2.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84b9d6481e4d842a39eecd3b601eaf18ed82fe59120a5798b1e283865fbd7b00 |
|
MD5 | fd9e73855057b5b805125a5cf1b891fd |
|
BLAKE2b-256 | 64115e9248f3fa169a02aab3cd61ea01316681f1dd6d8c8db062166ac472afe7 |
Close
Hashes for Logbook-1.2.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79160e53d72f5237d738584b095706dae43760d7fd544b8a89fdc7321e573224 |
|
MD5 | 432950db59dd602f46fdbf0a7c7ea3d8 |
|
BLAKE2b-256 | 836478a55ff7ee6219af231a3e5d71fd59e7bd3374196de5399c27f0c1feec12 |
Close
Hashes for Logbook-1.2.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cc347c1dfd72f52f2ce7fc1475b9741bd1533b123fb2dbd0f7396bbc337efe6 |
|
MD5 | a61df6e69c1239343536c6c7ed35b75e |
|
BLAKE2b-256 | 78a96e521326e7daafbccdce274c9081865d107cc10318d24641b131712179d9 |
Close
Hashes for Logbook-1.2.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e69d01e4609e36321ef4ddf004fb99a7cf406e9dc7902791cb38ace1b88bbdc |
|
MD5 | 5931ab9255e87764c154e4fccc75f49f |
|
BLAKE2b-256 | 8cfdb1db18b14d9f9993f8c5d0d78848deb63be0c78df57c785246d5a56ab9a3 |
Close
Hashes for Logbook-1.2.2-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d030b470ed8c1b955b6a6893f29eb4ae8f908e5ddd2de5a39d54b9180af85c8d |
|
MD5 | d9c294c0dd517b23fdd0ab62e890709f |
|
BLAKE2b-256 | 8ab45bfd29ee68631bde0ecb55effe2fa88afb8d93ff6e6cbbcee287ece6496c |
Close
Hashes for Logbook-1.2.2-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57074b423a481f14a530a1480ebbf7e28f7dac0a32a568103e1cf7051fd51eff |
|
MD5 | d9b817e93158203a32a1d965344b16c7 |
|
BLAKE2b-256 | d9e987a793fded3b00faebb2345ac07468637a52ae6aa8955b87283bcaa9a065 |