Making logs nicer since 2015!
Installation
sprockets.logging is available on the Python Package Index and can be installed via pip or easy_install:
pip install sprockets.logging
Documentation
Requirements
No external requirements
Example
This examples demonstrates the most basic usage of sprockets.logging
import logging
import sys
import sprockets.logging
formatter = logging.Formatter('%(levelname)s %(message)s {%(context)s}')
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(formatter)
handler.addFilter(sprockets.logging.ContextFilter(properties=['context']))
logging.Logger.root.addHandler(handler)
logging.Logger.root.setLevel(logging.DEBUG)
# Outputs: INFO Hi there {None}
logging.info('Hi there')
# Outputs: INFO No KeyError {bah}
logging.info('No KeyError', extra={'context': 'bah'})
# Outputs: INFO Now with context! {foo}
adapted = logging.LoggerAdapter(logging.Logger.root, extra={'context': 'foo'})
adapted.info('Now with context!')
Source
sprockets.logging source is available on Github at https://github.com/sprockets/sprockets.logging
License
sprockets.logging is released under the 3-Clause BSD license.
Release files for sprockets.logging 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sprockets.logging-1.3.2.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sprockets.logging-1.3.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / sprockets.logging-1.3.2.tar.gz
| Download URL | sprockets.logging-1.3.2.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf481f6a1853126b43d96a0ab5ca3e776c8b74566a40def505e5b187dc14c386
|
|
BLAKE2b-256 checksum How to use checksums |
4122cabce74b5e70009d6093dce1745436ec10740140ad462287d8971822d838
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / sprockets.logging-1.3.2-py2.py3-none-any.whl
| Download URL | sprockets.logging-1.3.2-py2.py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0495b2306fc972c89300929037db8ab40faa92ce1b7d70094528ec1627b42577
|
|
BLAKE2b-256 checksum How to use checksums |
7db7c64acdd19390d283f419e21fec5c9421c4076e59ee3f043bf7a03d9fa7f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |