Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brianbruggeman/termlog
A terminal logging library for docker-based python images
https://github.com/brianbruggeman/termlog
command-line docker logging python3 terminal
Last synced: 25 days ago
JSON representation
A terminal logging library for docker-based python images
- Host: GitHub
- URL: https://github.com/brianbruggeman/termlog
- Owner: brianbruggeman
- License: mit
- Created: 2019-06-04T21:33:58.000Z (over 5 years ago)
- Default Branch: stable
- Last Pushed: 2024-03-20T18:18:13.000Z (8 months ago)
- Last Synced: 2024-10-05T13:34:41.708Z (about 1 month ago)
- Topics: command-line, docker, logging, python3, terminal
- Language: Python
- Size: 959 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE.rst
Awesome Lists containing this project
README
======
Readme
======Termlog
=======.. image:: http://img.shields.io/badge/license-MIT-brightgreen.svg
:target: http://opensource.org/licenses/MIT.. image:: https://badge.fury.io/py/termlog.svg
:target: https://pypi.python.org/pypi/termlog.. image:: https://github.com/brianbruggeman/termlog/workflows/Latest%20Stable/badge.svg
:target: https://github.com/brianbruggeman/termlog/actions.. image:: https://codecov.io/gh/brianbruggeman/termlog/branch/stable/graph/badge.svg?token=y6xPnPtcdc
:target: https://codecov.io/gh/brianbruggeman/termlogTermlog: 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
=====.. code-block:: python
from termlog import blue, echo, red, rgb, set_config
key = 'abc'
value = 123set_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.
.. code-block:: bash
$ pip install termlog
.. include::./CONTRIBUTING.rst