Skip to main content

Command line interface logging.

Project description

Command Line Interface Log

This python module is used to make your command line / terminal more fancy when printing / logging certain events.

For a more detailed documentation checkout the docs: https://deltabotics.github.io/cli-log

Quick install

pip install cli-log

Examples

Basic usage

import cli

cli.info("Hello world!\nInfo event.")
cli.debug("Debug event.")
cli.warn(prefix="CORE", message="Warning event.")
cli.error("Error event.")
[16:30:52 / INFO] Hello world!
[16:30:52 / INFO] Info event.
[16:30:52 / DEBUG] Debug event.
[16:30:52 / WARN][CORE] Warning event.
[16:30:52 / ERROR] Error event.

Advanced usage

import cli

cli.info("Hello world!")
cli.add(severity="Testing", message="Hello", prefix="test", color=cli.MAGENTA)
cli.init(log_format="[{time} ! {severity}]{prefix} {message}", reset=True)
cli.error("Error between error raising.")
cli.init(reset=True) # Doesn't do anything because we didnt set format before
cli.debug("Should not get executed.")
cli.init(log_format="[{severity} ! {time}]{prefix} {message}")
cli.info(message="Hello", color=cli.BLACK)
[16:30:52 / INFO] Hello world!
[16:30:52 / TESTING][test] Hello
Traceback (most recent call last):
    File "usr/local/lib/python3.11/site-packages\cli-log\initialise.py", line 18, in init
        raise ValueError("Cannot use 'reset' parameter in combination with 'log_format'")
ValueError: Cannot use 'reset' parameter in combination with 'log_format'

[16:30:52 ! ERROR] Error between error raising.
[16:30:52 / DEBUG] Should not get executed.
[16:30:52 ! INFO] Hello

Here you can see that an error was raised due to the usage of the reset parameter in combination with the log_format parameter.

You can also see that the [16:30:52 / DEBUG] is not using [16:30:52 ! DEBUG] because the format was reset.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli-log-1.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

cli_log-1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file cli-log-1.1.tar.gz.

File metadata

  • Download URL: cli-log-1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for cli-log-1.1.tar.gz
Algorithm Hash digest
SHA256 99ea3dfec9b0af0c9689accb4dd34b47a3a5fbfa4583366cec1a515777f6e495
MD5 f16a5edd7158d39c88019ecdc6eb8847
BLAKE2b-256 dd03f22345653480b4620b9e1fdd03efdccefed6c9a98b53900e497502a24914

See more details on using hashes here.

File details

Details for the file cli_log-1.1-py3-none-any.whl.

File metadata

  • Download URL: cli_log-1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for cli_log-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbe1d833301dbeb1512a391736febda5dbf49972609b40eb855ccebbf353d089
MD5 9a1d0975e9887a0ec0743e1935c3eaa4
BLAKE2b-256 2ca4834ad41bff74604a1b19193eb53352cb9218f0782b110c7fac4c36e74d43

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page