Skip to main content

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

  1. trace, verbose
  2. debug
  3. info, log
  4. warn
  5. error
  6. critical, 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:

  1. {string} Case insensitive name of minimal log level. defaults to "info"
  2. {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:

  1. {any} Record's "message" field. Traditionally this would be a string or an exception.
  2. {dictionary} {'Key':'Value'} pairs, optional. Values should be JSON serializable
logger.info("something, something", { dark: "side" })

Metadata

Release files for jonson 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jonson 1.1.1
File Size Uploaded
jonson-1.1.1.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jonson 1.1.1
File Interpreter ABI Platform
jonson-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / jonson-1.1.1.tar.gz

Download URL jonson-1.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b523df1568027e8ea6af81c1712532fec8f58ea5b827c924eb2d78a0c4df83b0
BLAKE2b-256 checksum
How to use checksums
13cae86c2b670e936871f6820aa49642d8043e3c93d7c618f1e3c2ac7c601f3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release files / jonson-1.1.1-py3-none-any.whl

Download URL jonson-1.1.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2f99d10216edb972f63358a6ec311d87190d569def39b582e7a68538a9a15df
BLAKE2b-256 checksum
How to use checksums
d382bf043a863a9c16307a5fccbb55ca17dc595ebe0793009c660be7f3d4f610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page