Skip to main content

Termlog

http://img.shields.io/badge/license-MIT-brightgreen.svg https://badge.fury.io/py/termlog.svg https://github.com/brianbruggeman/termlog/workflows/Latest%20Stable/badge.svg https://codecov.io/gh/brianbruggeman/termlog/branch/stable/graph/badge.svg?token=y6xPnPtcdc

Termlog: A terminal logging library for logging data both as lexed text or json

Motivation

I love f-strings and I wanted a method of displaying beautiful f-strings in command-line interfaces. However, I needed a way of simultaneously creating a developer friendly text log and producing structured text that could be interpreted by a log-shipper in a clustered environment.

Termlog will…

  • wrap print statements with a new method, echo

  • echo is fully compatible with print and is meant to be a drop-in replacement

  • echo can immediately control: color, json, timestamp, time-format outputs on each invocation

  • Alternatively, a set_config command can set the library to use a specific configuration for each subsequent call to echo

Usage

from termlog import blue, echo, red, rgb, set_config

key = 'abc'
value = 123

set_config(color=True, json=False)

echo(f'{red(key)}: {blue(value)}')
echo(f'{rgb(message=key, red=71, green=61, blue=139)}: {blue(value)}')
echo(f'{key}: {blue(value)}', color=True)

Installation

To install termlog, simply run the following.

$ pip install termlog

Metadata

Release files for termlog 1.4.0

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

Source distribution (sdist)

Source distribution for termlog 1.4.0
File Size Uploaded Provenance Actions
termlog-1.4.0.tar.gz 19.9 kB Without provenance Details for termlog-1.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 44.5 kB

Release files / termlog-1.4.0.tar.gz

Download URL termlog-1.4.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a6fa0b832697846a27730ba7de860ea5231ef6b801b309061f1a15eb52748827
BLAKE2b-256 checksum
How to use checksums
543df4fcbdd266ca657dc692378edd5851dd484be0db21cdd6d15b607340667b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.10 Darwin/20.6.0

Release files / termlog-1.4.0-py3-none-any.whl

Download URL termlog-1.4.0-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fed4be2e790f95c28846b79e9f4434e7f72c34f6760bdb40a990fe625834fc3
BLAKE2b-256 checksum
How to use checksums
f2892073a506fb09605af0058a84876f297d53f64b61aeb85392725b200fd9e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.10 Darwin/20.6.0

Security for termlog 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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