A teensy structured JSON logger for python.
Project description
lignum
A teensy structured JSON logger for python.
Usage
Install lignum with pip:
pip install lignum
Initialize the logger and use the level functions to start logging messages:
import lignum
log = lignum.Logger()
log.info('Application started.') # Prints {"timestamp":1724129120,"message":"Application started.","level":"info"} to STDERR
By default, lignum prints to sys.stderr. You can use another stream type by specifying it in the
arguments:
import lignum
log = lignum.Logger(sys.stdout)
log.error('The system is down.') # Prints {"timestamp":17241236120,"message":"The system is down.","level":"error"} to STDOUT
You can use a File as a stream to log to files on disk:
import lignum
with open('log.log','w') as f:
log = lignum(f)
log.warn('I will haunt your dreams.') # Prints {"timestamp":17241336120,"message":"I will haunt your dreams.","level":"warn"} to ./log.log
Add additional fields using extra dictionaries:
import lignum
log = lignum()
log.debug('Unknown value.', { 'value': mystery }) # Prints {"timestamp":1724149120,"message":"Unknown value.","level":"debug","value":-32768} to STDERR
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lignum-0.0.3.tar.gz.
File metadata
- Download URL: lignum-0.0.3.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b63bd2d037fa6ab9c8b07138ad1bce925e7d9c5ff925d9e04dd41287ef0584f8
|
|
| MD5 |
9fee5777b0306f032cc490d60b3992aa
|
|
| BLAKE2b-256 |
f4deccadbc0ed034306f9272037ae94a39e5b4e8e6a45d00346cb5e54dbd2da2
|
File details
Details for the file lignum-0.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: lignum-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71b587199af6973e5ecf0e9846754f6422cc1cdc105826bd8b89e9b16286001
|
|
| MD5 |
2708ea1d650b79dcbd80ee4986b285bc
|
|
| BLAKE2b-256 |
d295dfac2bd15803bb5a21ccdb22ba35ef2eebf02bd8fc40e97d99c152df01f7
|