termlog v1.0.2: A terminal logging library
Project description
Package
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
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
Hashes for termlog-1.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d067a5d8ecdf0d5158c1a9692da8e8cce6697e15b079e58eecebaba431489971 |
|
MD5 | d6961f0d0b2c03e0d218835d56efdbb3 |
|
BLAKE2b-256 | 3bba4db62ac91002611297030c2accdd3ceb8299acbe5b55b29f2969f936827e |