cli-log


Namecli-log JSON
Version 1.1 PyPI version JSON
download
home_pagehttps://deltabotics.github.io/cli-log
SummaryCommand line interface logging.
upload_time2024-07-09 00:46:13
maintainerNone
docs_urlNone
authorDeltaBotics
requires_pythonNone
licenseMIT
keywords logging
VCS
bugtrack_url
requirements colorama
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://deltabotics.github.io/cli-log",
    "name": "cli-log",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "logging",
    "author": "DeltaBotics",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/dd/03/f22345653480b4620b9e1fdd03efdccefed6c9a98b53900e497502a24914/cli-log-1.1.tar.gz",
    "platform": null,
    "description": "# Command Line Interface Log\n\nThis python module is used to make your command line / terminal more fancy when printing / logging certain events.\n\nFor a more detailed documentation checkout the docs: https://deltabotics.github.io/cli-log\n\n## Quick install\n\n```bash\npip install cli-log\n```\n\n## Examples\n\n### Basic usage\n```python\nimport cli\n\ncli.info(\"Hello world!\\nInfo event.\")\ncli.debug(\"Debug event.\")\ncli.warn(prefix=\"CORE\", message=\"Warning event.\")\ncli.error(\"Error event.\")\n```\n\n```log\n[16:30:52 / INFO] Hello world!\n[16:30:52 / INFO] Info event.\n[16:30:52 / DEBUG] Debug event.\n[16:30:52 / WARN][CORE] Warning event.\n[16:30:52 / ERROR] Error event.\n```\n\n### Advanced usage\n```python\nimport cli\n\ncli.info(\"Hello world!\")\ncli.add(severity=\"Testing\", message=\"Hello\", prefix=\"test\", color=cli.MAGENTA)\ncli.init(log_format=\"[{time} ! {severity}]{prefix} {message}\", reset=True)\ncli.error(\"Error between error raising.\")\ncli.init(reset=True) # Doesn't do anything because we didnt set format before\ncli.debug(\"Should not get executed.\")\ncli.init(log_format=\"[{severity} ! {time}]{prefix} {message}\")\ncli.info(message=\"Hello\", color=cli.BLACK)\n```\n\n```log\n[16:30:52 / INFO] Hello world!\n[16:30:52 / TESTING][test] Hello\nTraceback (most recent call last):\n    File \"usr/local/lib/python3.11/site-packages\\cli-log\\initialise.py\", line 18, in init\n        raise ValueError(\"Cannot use 'reset' parameter in combination with 'log_format'\")\nValueError: Cannot use 'reset' parameter in combination with 'log_format'\n\n[16:30:52 ! ERROR] Error between error raising.\n[16:30:52 / DEBUG] Should not get executed.\n[16:30:52 ! INFO] Hello\n```\nHere you can see that an error was raised due to the usage of the `reset` parameter in combination with the `log_format` parameter.\n\nYou can also see that the `[16:30:52 / DEBUG]` is not using `[16:30:52 ! DEBUG]` because the format was reset.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Command line interface logging.",
    "version": "1.1",
    "project_urls": {
        "Homepage": "https://deltabotics.github.io/cli-log",
        "Source": "https://github.com/DeltaBotics/cli-log"
    },
    "split_keywords": [
        "logging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ca4834ad41bff74604a1b19193eb53352cb9218f0782b110c7fac4c36e74d43",
                "md5": "9a1d0975e9887a0ec0743e1935c3eaa4",
                "sha256": "fbe1d833301dbeb1512a391736febda5dbf49972609b40eb855ccebbf353d089"
            },
            "downloads": -1,
            "filename": "cli_log-1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9a1d0975e9887a0ec0743e1935c3eaa4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8918,
            "upload_time": "2024-07-09T00:46:12",
            "upload_time_iso_8601": "2024-07-09T00:46:12.511646Z",
            "url": "https://files.pythonhosted.org/packages/2c/a4/834ad41bff74604a1b19193eb53352cb9218f0782b110c7fac4c36e74d43/cli_log-1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd03f22345653480b4620b9e1fdd03efdccefed6c9a98b53900e497502a24914",
                "md5": "f16a5edd7158d39c88019ecdc6eb8847",
                "sha256": "99ea3dfec9b0af0c9689accb4dd34b47a3a5fbfa4583366cec1a515777f6e495"
            },
            "downloads": -1,
            "filename": "cli-log-1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f16a5edd7158d39c88019ecdc6eb8847",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7509,
            "upload_time": "2024-07-09T00:46:13",
            "upload_time_iso_8601": "2024-07-09T00:46:13.907936Z",
            "url": "https://files.pythonhosted.org/packages/dd/03/f22345653480b4620b9e1fdd03efdccefed6c9a98b53900e497502a24914/cli-log-1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-09 00:46:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DeltaBotics",
    "github_project": "cli-log",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "colorama",
            "specs": [
                [
                    "==",
                    "0.4.6"
                ]
            ]
        }
    ],
    "lcname": "cli-log"
}
        
Elapsed time: 0.39046s