Metadata-Version: 2.1
Name: cli-log
Version: 1.0
Summary: Command line interface logging.
Home-page: https://github.com/DeltaBotics/cli-log
Author: DeltaBotics
License: MIT
Project-URL: Source, https://github.com/DeltaBotics/cli-log
Keywords: logging
Classifier: Intended Audience :: Developers
Classifier: Topic :: System :: Logging
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
License-File: LICENSE

# Command Line Interface

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

## Quick install

```bash
pip install cli-log
```

## Examples

### Basic usage
```python
import cli

cli.info("Hello world!\nInfo event.")
cli.debug("Debug event.")
cli.warn(prefix="CORE", message="Warning event.")
cli.error("Error event.")
```

```log
[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
```python
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)
```

```log
[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.
