Skip to main content

TestStatus PyPiStatus BlackStyle BlackPackStyle MITLicenseBadge

Uses python’s awesome logging-library and configures it to write JSON-lines. In JSON-lines, each line in the log is a valid json-object. This makes the log easy to read with a machine.

install

pip install json-line-logger

usage

There are three handy constructors for loggers: LoggerFile, LoggerStream, and LoggerStdout.

import json_line_logger

logger = json_line_logger.LoggerFile(path="test.log.jsonl")

logger.debug("This is a log message")

with json_line_logger.TimeDelta(logger=logger, name="some costly task"):
    result_of_a_costly_task = 1 + 1

json_line_logger.shutdown(logger=logger)

Yields a logfile test.log.jsonl which contains:

{"t":"1886-03-27T11:01:01.341", "l":"DEBUG", "m":"This is a log message"}
{"t":"1886-03-27T11:01:01.341", "l":"INFO", "m":"<TimeDelta name='some costly task' delta='2.1457672119140625e-06'/>"}

Metadata

Release files for json-line-logger 0.0.10

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

Source distribution (sdist)

Source distribution for json-line-logger 0.0.10
File Size Uploaded
json_line_logger-0.0.10.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json-line-logger 0.0.10
File Interpreter ABI Platform
json_line_logger-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / json_line_logger-0.0.10.tar.gz

Download URL json_line_logger-0.0.10.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7f6c2fe0e3bcbeb01225b99e92ab3dbd2d8e75d9449649d0b5d0f474bcd3e9d0
BLAKE2b-256 checksum
How to use checksums
c682001c887403a6034150037dac7a40c258a0380dcceae7a8da97346dcb3127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / json_line_logger-0.0.10-py3-none-any.whl

Download URL json_line_logger-0.0.10-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3f5ece77cc076d08dd716c3a1af55a6f7f07930bacd880497ec4e65a6174c56
BLAKE2b-256 checksum
How to use checksums
ea60216716366c0cd487037370d621f42be4b2822e435ff241eaf9fbb173b128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.4

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