out-of-the-box, ready-to-use JSON logger
Project description
jonson

out-of-the-box, ready-to-use JSON logger
from jonson import logger
logger.info("Something going as expected", { "host": socket.gethostname() })
logger.warn("Something must have gone terribly wrong")
except Exception as e:
logger.error(e, { description: "something descriptive" })
Log level
Create logger instance with a minimal log level
from jonson import Logger
logger = Logger("warn")
logger.info("Something going as expected", { "host": socket.gethostname() }) # ignored
logger.warn("Something must have gone terribly wrong") # sent
Log levels hirarchy
A few synonyms are available for convenience
trace,verbosedebuginfo,logwarnerrorcritical,fatal,panic
For example, a logger with log level "warn" will only print logs with level "warn", "error", or "critical".
Arguments
Create: Logger class accepts one or two arguments:
{string}Case insensitive name of minimal log level. defaults to"info"{dictionary}{'Key':'Value'} pairs, optional. Persistent enrichment fields for all log records
logger = Logger(os.environ["LOG_LEVEL"], { "host": socket.gethostname() })
Send: Logger functions accept one or two arguments:
{any}Record's "message" field. Traditionally this would be a string or an exception.{dictionary}{'Key':'Value'} pairs, optional. Values should be JSON serializable
logger.info("something, something", { dark: "side" })
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 jonson-1.1.1.tar.gz.
File metadata
- Download URL: jonson-1.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b523df1568027e8ea6af81c1712532fec8f58ea5b827c924eb2d78a0c4df83b0
|
|
| MD5 |
1042b3a59f752cc4ab0e594599b0e33f
|
|
| BLAKE2b-256 |
13cae86c2b670e936871f6820aa49642d8043e3c93d7c618f1e3c2ac7c601f3a
|
File details
Details for the file jonson-1.1.1-py3-none-any.whl.
File metadata
- Download URL: jonson-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2f99d10216edb972f63358a6ec311d87190d569def39b582e7a68538a9a15df
|
|
| MD5 |
825652cf1d514289e07d6ad6439008cf
|
|
| BLAKE2b-256 |
d382bf043a863a9c16307a5fccbb55ca17dc595ebe0793009c660be7f3d4f610
|