Name | logtale JSON |
Version |
0.0.8
JSON |
| download |
home_page | |
Summary | A simple, easy to use python logging framework that builds on top of the built-in logger module |
upload_time | 2023-12-19 03:02:55 |
maintainer | |
docs_url | None |
author | Jason Jerome |
requires_python | >=3.8 |
license | |
keywords |
python
logging
log
logger
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
### LogTale - A python logging framework
A simple, easy to use logging framework that builds on top of the built-in logger module.
[![PyPI version](https://badge.fury.io/py/logtale.svg)](https://pypi.org/project/logtale/0.0.7/)
### Installation
``` bash
pip install logtale
```
### Usage
Simple Usage:
``` python
import logtale.logtale as tale
def main():
logtale = tale.LogTale("example", "./example.toml")
logger = logtale.logger.getChild(__name__)
logger.debug("test - debug")
logger.info("test - info")
logger.warning("test - warning")
logger.error("test - error")
logger.critical("test - critical")
if __name__ == "__main__":
main()
```
Prepend/Postpend text to the log message:
``` python
logger.addFilter(filter.LogFilter(prepend_text="ExamplePrepend"))
logger.addFilter(filter.LogFilter(postpend_text="ExamplePostpend"))
```
### Configuration File
Create a configuration file for logging settings using the `templates/config_template.toml` file as a template.
``` toml
[output.colors]
# Set the colors associated with each debug level.
# Colors are only applied for logs printed to the console.
# The logging color feature can be enabled/disabled in '[output.console]' section.
DEBUG = '\033[1;36m'
INFO = '\033[1;38m'
WARNING = '\033[1;33m'
ERROR = '\033[1;35m'
CRITICAL = '\033[1;31m'
[output.file]
enable = true # enable/disable logging to a .log file (default=true)
level = "DEBUG" # the base log level for logging to a file (default=DEBUG)
path = "logs/" # the directory to create log files in (default=logs/)
format = "(%(asctime)s)[%(name)s][%(levelname)s]::%(message)s" # the log message format to use for file logging
name = "example.log" # the naming scheme of the log file, by default it's '<project_name>_<version>_<timestamp>.log'
[output.console]
enable = true # enable/disable logging to the console (default=true)
level = "DEBUG" # the base log level for logging to the console (default=DEBUG)
format = "[%(levelname)s]::%(message)s" # the log message format to use for console logging
use_colors = true # enable/disable the use of colors for log levels. colors can be customized in '[output.colors]' section.
```
### Examples
Check the `examples` directory for example scripts and configuration files.
``` python
# ./examples/example.py
import logtale.logtale as tale
import logtale.filter as filter
def main():
logtale = tale.LogTale("example", "./example.toml")
logger = logtale.logger.getChild(__name__)
logger.addFilter(filter.LogFilter(prepend_text="ExamplePrepend"))
logger.debug("test - debug")
logger.info("test - info")
logger.warning("test - warning")
logger.error("test - error")
logger.critical("test - critical")
if __name__ == "__main__":
main()
```
#### Example log console output
![example console output image](./examples/example_console_output.png)
#### Example log file output
![example file output image](./examples/example_file_output.png)
Raw data
{
"_id": null,
"home_page": "",
"name": "logtale",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "python,logging,log,logger",
"author": "Jason Jerome",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/42/36/f25afe88aa41d119417f9a63a5bce680436133f76369bae6267a5d31f2bd/logtale-0.0.8.tar.gz",
"platform": null,
"description": "### LogTale - A python logging framework\nA simple, easy to use logging framework that builds on top of the built-in logger module.\n\n[![PyPI version](https://badge.fury.io/py/logtale.svg)](https://pypi.org/project/logtale/0.0.7/)\n\n### Installation\n``` bash\npip install logtale\n```\n\n### Usage\nSimple Usage:\n``` python\nimport logtale.logtale as tale\n\n\ndef main():\n logtale = tale.LogTale(\"example\", \"./example.toml\")\n logger = logtale.logger.getChild(__name__)\n\n logger.debug(\"test - debug\")\n logger.info(\"test - info\")\n logger.warning(\"test - warning\")\n logger.error(\"test - error\")\n logger.critical(\"test - critical\")\n\nif __name__ == \"__main__\":\n main()\n```\n\nPrepend/Postpend text to the log message:\n``` python\nlogger.addFilter(filter.LogFilter(prepend_text=\"ExamplePrepend\"))\nlogger.addFilter(filter.LogFilter(postpend_text=\"ExamplePostpend\"))\n```\n\n### Configuration File\nCreate a configuration file for logging settings using the `templates/config_template.toml` file as a template.\n\n``` toml\n[output.colors]\n# Set the colors associated with each debug level.\n# Colors are only applied for logs printed to the console.\n# The logging color feature can be enabled/disabled in '[output.console]' section.\nDEBUG = '\\033[1;36m'\nINFO = '\\033[1;38m'\nWARNING = '\\033[1;33m'\nERROR = '\\033[1;35m'\nCRITICAL = '\\033[1;31m'\n\n[output.file]\nenable = true # enable/disable logging to a .log file (default=true)\nlevel = \"DEBUG\" # the base log level for logging to a file (default=DEBUG)\npath = \"logs/\" # the directory to create log files in (default=logs/)\nformat = \"(%(asctime)s)[%(name)s][%(levelname)s]::%(message)s\" # the log message format to use for file logging\nname = \"example.log\" # the naming scheme of the log file, by default it's '<project_name>_<version>_<timestamp>.log'\n\n[output.console]\nenable = true # enable/disable logging to the console (default=true)\nlevel = \"DEBUG\" # the base log level for logging to the console (default=DEBUG)\nformat = \"[%(levelname)s]::%(message)s\" # the log message format to use for console logging\nuse_colors = true # enable/disable the use of colors for log levels. colors can be customized in '[output.colors]' section.\n```\n\n### Examples\nCheck the `examples` directory for example scripts and configuration files.\n\n``` python\n# ./examples/example.py\nimport logtale.logtale as tale\nimport logtale.filter as filter\n\n\ndef main():\n logtale = tale.LogTale(\"example\", \"./example.toml\")\n logger = logtale.logger.getChild(__name__)\n logger.addFilter(filter.LogFilter(prepend_text=\"ExamplePrepend\"))\n\n logger.debug(\"test - debug\")\n logger.info(\"test - info\")\n logger.warning(\"test - warning\")\n logger.error(\"test - error\")\n logger.critical(\"test - critical\")\n\nif __name__ == \"__main__\":\n main()\n```\n\n#### Example log console output\n![example console output image](./examples/example_console_output.png)\n\n#### Example log file output\n![example file output image](./examples/example_file_output.png)\n",
"bugtrack_url": null,
"license": "",
"summary": "A simple, easy to use python logging framework that builds on top of the built-in logger module",
"version": "0.0.8",
"project_urls": {
"Changelog": "https://github.com/DuckBoss/logtale/blob/master/CHANGELOG.md",
"Documentation": "https://github.com/DuckBoss/logtale",
"Homepage": "https://github.com/DuckBoss/logtale",
"Issues": "https://github.com/DuckBoss/logtale/issues",
"Repository": "https://github.com/DuckBoss/logtale.git"
},
"split_keywords": [
"python",
"logging",
"log",
"logger"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4386b1c137afe3982d2bf98c640ea87acc49d9b474f504944fec0bf84db3a9e2",
"md5": "5a6b1a08cc25f73cc1b9d9f66f4640c3",
"sha256": "3052bad932a3151554f9af4b66e2c74e3052fd4a71731d2ec1bf0775e672d1b3"
},
"downloads": -1,
"filename": "logtale-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5a6b1a08cc25f73cc1b9d9f66f4640c3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 17451,
"upload_time": "2023-12-19T03:02:53",
"upload_time_iso_8601": "2023-12-19T03:02:53.561355Z",
"url": "https://files.pythonhosted.org/packages/43/86/b1c137afe3982d2bf98c640ea87acc49d9b474f504944fec0bf84db3a9e2/logtale-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4236f25afe88aa41d119417f9a63a5bce680436133f76369bae6267a5d31f2bd",
"md5": "81da9f30e764e15f35fbe3f15bc098a9",
"sha256": "b14a22a94cd29556ef711ec98e4fa56239631c15698b04a2b3a3bab4c6043bb2"
},
"downloads": -1,
"filename": "logtale-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "81da9f30e764e15f35fbe3f15bc098a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 109617,
"upload_time": "2023-12-19T03:02:55",
"upload_time_iso_8601": "2023-12-19T03:02:55.509519Z",
"url": "https://files.pythonhosted.org/packages/42/36/f25afe88aa41d119417f9a63a5bce680436133f76369bae6267a5d31f2bd/logtale-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-19 03:02:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DuckBoss",
"github_project": "logtale",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "logtale"
}