[![PyPI version](https://badge.fury.io/py/tinLogging.svg)](https://badge.fury.io/py/tinLogging)
[![Python versions](https://img.shields.io/pypi/pyversions/tinLogging.svg)](https://pypi.org/project/tinLogging/)
[![License](https://img.shields.io/pypi/l/tinLogging.svg)](https://pypi.org/project/tinLogging/)
[![GitHub stars](https://img.shields.io/github/stars/Tinokil/tinLogging.svg)](https://github.com/Tinokil/tinLogging/stargazers)
[![GitHub release date](https://img.shields.io/github/release-date/Tinokil/tinLogging.svg)](https://github.com/Tinokil/tinLogging/releases)
# tinLogging
`tinLogging` is a versatile logging library for Python that provides a range of functionalities to enhance your application's logging capabilities
## Installation
`pip install tinLogging`
## Update
`pip install --upgrade tinLogging`
## Quick start
```python
from tinLogging import Logger, ConsoleLogger
logger = Logger(filename='log.txt', level='DEBUG', buffer_size=10, log_format='[%time] - %lvl | %text')
console_logger = ConsoleLogger(level='DEBUG', log_format='%time | %lvl | %text')
# Writing a log to a file 'log.txt'
logger.debug('This is a debug message')
# Log output to the console
console_logger.debug('This is a debug message')
console_logger.info('This is an info message')
console_logger.warning('This is a warning message')
console_logger.error('This is an error message')
```
This is what the color text output looks like in the console:
![Console Output](https://github.com/Tinokil/tinLogging/raw/main/images/quick_start_console.PNG)
## Logging to a file
### Main functions
```python
from tinLogging import Logger
logger = Logger(filename='log.txt', level='DEBUG', buffer_size=10, log_format='[%time] - %lvl | %text')
# Enabling automatic file rotation with zip archiving
logger.rotate_logs(max_megabytes_size=1, zip_compression=True, auto_rotate=True)
# Sending a log
logger.critical('This is a critical message')
# Creating a new log level with priority 3
logger.new_level(level_name='MyNewLevel', level_priority=3)
# Sending a log with a new level
logger.log('MyNewLevel', 'This is a MyNewLevel message')
# Deleting the old log level
logger.del_level('WARNING')
```
### Additional functions
#### Export
``` Python
logger.export_json(export_file='my_export_log.json')
logger.export_html(export_file='my_new_export_log.html')
```
#### Search and filtering
``` Python
# Text search
search = logger.search_logs('message')
# Filtering by level
filter_logs = logger.filter_logs('CRITICAL')
```
#### Statistics
``` Python
logger.log_stats(files_name='log.txt')
```
#### Archiving
``` Python
logger.archive_logs(archive_name='my_zip_log.zip')
```
#### Checking for acceptable file size
``` Python
logger.monitor_log_size(max_megabytes_size=8)
# Returns True if it exceeds the specified size
```
#### Buffer
``` Python
# buffer_size - buffer size for optimizing I/O requests
logger = Logger(filename='log.txt', level='DEBUG', buffer_size=10, log_format='[%time] - %lvl | %text')
# Recording the remaining logs in the buffer
logger.close()
```
## Logging to a Console
Logging into the console will allow you to display colored logs to facilitate the search for the necessary logging levels. But do not forget that after restarting the interpreter, the console is cleared
```python
from tinLogging import ConsoleLogger
# You can customize the colors to suit your taste, but by default there are always the most suitable colors
logger = ConsoleLogger(level='DEBUG', log_format='%time | %lvl | %text', debug_color='standard', info_color='green')
# Creating a new log level
logger.new_level('HTTP', 4)
# Logging with the HTTP level highlighted in green
logger.log(level='HTTP', message='Code 200 - the site is working', color='green')
```
## Contributing
We welcome contributions to the `tinLogging` project! If you have any bug reports, feature requests, or pull requests, please feel free to submit them on our [GitHub repository](https://github.com/Tinokil/tinLogging)
## License
`tinLogging` is licensed under the MIT License. See the [LICENSE](https://github.com/Tinokil/tinLogging/blob/main/LICENSE) file for more information
Raw data
{
"_id": null,
"home_page": "https://github.com/Tinokil/tinLogging/",
"name": "tinLogging",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "Logging, tinLogging, Logger, tinLogger, python logging",
"author": "tinokil",
"author_email": "zemedeuk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2a/87/08a83f0fd8db75fa6019c7624ac3651a54fe26bfa6d25d40d17740847f7b/tinlogging-0.0.3.tar.gz",
"platform": null,
"description": "[![PyPI version](https://badge.fury.io/py/tinLogging.svg)](https://badge.fury.io/py/tinLogging)\r\n[![Python versions](https://img.shields.io/pypi/pyversions/tinLogging.svg)](https://pypi.org/project/tinLogging/)\r\n[![License](https://img.shields.io/pypi/l/tinLogging.svg)](https://pypi.org/project/tinLogging/)\r\n[![GitHub stars](https://img.shields.io/github/stars/Tinokil/tinLogging.svg)](https://github.com/Tinokil/tinLogging/stargazers)\r\n[![GitHub release date](https://img.shields.io/github/release-date/Tinokil/tinLogging.svg)](https://github.com/Tinokil/tinLogging/releases)\r\n\r\n# tinLogging\r\n`tinLogging` is a versatile logging library for Python that provides a range of functionalities to enhance your application's logging capabilities\r\n## Installation\r\n`pip install tinLogging`\r\n## Update\r\n`pip install --upgrade tinLogging`\r\n## Quick start\r\n```python\r\nfrom tinLogging import Logger, ConsoleLogger\r\n\r\nlogger = Logger(filename='log.txt', level='DEBUG', buffer_size=10, log_format='[%time] - %lvl | %text')\r\nconsole_logger = ConsoleLogger(level='DEBUG', log_format='%time | %lvl | %text')\r\n# Writing a log to a file 'log.txt'\r\nlogger.debug('This is a debug message')\r\n# Log output to the console\r\nconsole_logger.debug('This is a debug message')\r\nconsole_logger.info('This is an info message')\r\nconsole_logger.warning('This is a warning message')\r\nconsole_logger.error('This is an error message')\r\n```\r\nThis is what the color text output looks like in the console:\r\n![Console Output](https://github.com/Tinokil/tinLogging/raw/main/images/quick_start_console.PNG)\r\n## Logging to a file\r\n### Main functions\r\n```python\r\nfrom tinLogging import Logger\r\n\r\nlogger = Logger(filename='log.txt', level='DEBUG', buffer_size=10, log_format='[%time] - %lvl | %text')\r\n# Enabling automatic file rotation with zip archiving\r\nlogger.rotate_logs(max_megabytes_size=1, zip_compression=True, auto_rotate=True)\r\n# Sending a log\r\nlogger.critical('This is a critical message')\r\n# Creating a new log level with priority 3\r\nlogger.new_level(level_name='MyNewLevel', level_priority=3)\r\n# Sending a log with a new level\r\nlogger.log('MyNewLevel', 'This is a MyNewLevel message')\r\n# Deleting the old log level\r\nlogger.del_level('WARNING')\r\n```\r\n### Additional functions\r\n#### Export\r\n``` Python\r\nlogger.export_json(export_file='my_export_log.json')\r\nlogger.export_html(export_file='my_new_export_log.html')\r\n```\r\n#### Search and filtering\r\n``` Python\r\n# Text search\r\nsearch = logger.search_logs('message')\r\n# Filtering by level\r\nfilter_logs = logger.filter_logs('CRITICAL')\r\n```\r\n#### Statistics\r\n``` Python\r\nlogger.log_stats(files_name='log.txt')\r\n```\r\n#### Archiving\r\n``` Python\r\nlogger.archive_logs(archive_name='my_zip_log.zip')\r\n```\r\n#### Checking for acceptable file size\r\n``` Python\r\nlogger.monitor_log_size(max_megabytes_size=8)\r\n# Returns True if it exceeds the specified size\r\n```\r\n#### Buffer\r\n``` Python\r\n# buffer_size - buffer size for optimizing I/O requests\r\nlogger = Logger(filename='log.txt', level='DEBUG', buffer_size=10, log_format='[%time] - %lvl | %text')\r\n# Recording the remaining logs in the buffer\r\nlogger.close()\r\n```\r\n## Logging to a Console\r\nLogging into the console will allow you to display colored logs to facilitate the search for the necessary logging levels. But do not forget that after restarting the interpreter, the console is cleared\r\n```python\r\nfrom tinLogging import ConsoleLogger\r\n# You can customize the colors to suit your taste, but by default there are always the most suitable colors\r\nlogger = ConsoleLogger(level='DEBUG', log_format='%time | %lvl | %text', debug_color='standard', info_color='green')\r\n# Creating a new log level\r\nlogger.new_level('HTTP', 4)\r\n# Logging with the HTTP level highlighted in green\r\nlogger.log(level='HTTP', message='Code 200 - the site is working', color='green')\r\n```\r\n## Contributing\r\nWe welcome contributions to the `tinLogging` project! If you have any bug reports, feature requests, or pull requests, please feel free to submit them on our [GitHub repository](https://github.com/Tinokil/tinLogging)\r\n## License\r\n`tinLogging` is licensed under the MIT License. See the [LICENSE](https://github.com/Tinokil/tinLogging/blob/main/LICENSE) file for more information\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python library for convenient and beautiful logging of information",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/Tinokil/tinLogging/",
"Source Code": "https://github.com/Tinokil/tinLogging/blob/main/tinLogging/logging.py"
},
"split_keywords": [
"logging",
" tinlogging",
" logger",
" tinlogger",
" python logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "861c81e983291fd7ef5bc334034120d8ba3e851e5f6a0e267d6be7679ee6c451",
"md5": "66cd8679f53d90c20889b796f40e34ce",
"sha256": "cda3009b9a19a06aba1abb7d9c4e7678e0edd9c18834010af2036eb46349a7a8"
},
"downloads": -1,
"filename": "tinLogging-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "66cd8679f53d90c20889b796f40e34ce",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6479,
"upload_time": "2024-08-08T20:05:03",
"upload_time_iso_8601": "2024-08-08T20:05:03.064528Z",
"url": "https://files.pythonhosted.org/packages/86/1c/81e983291fd7ef5bc334034120d8ba3e851e5f6a0e267d6be7679ee6c451/tinLogging-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2a8708a83f0fd8db75fa6019c7624ac3651a54fe26bfa6d25d40d17740847f7b",
"md5": "5d25471aa5fdc76b41c4d0fedf9fe412",
"sha256": "7218786df6d4db9a19d88ba5e15bd7c1de955b7f16ba0a16eb45ef36e8ec8269"
},
"downloads": -1,
"filename": "tinlogging-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "5d25471aa5fdc76b41c4d0fedf9fe412",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7913,
"upload_time": "2024-08-08T20:05:04",
"upload_time_iso_8601": "2024-08-08T20:05:04.583466Z",
"url": "https://files.pythonhosted.org/packages/2a/87/08a83f0fd8db75fa6019c7624ac3651a54fe26bfa6d25d40d17740847f7b/tinlogging-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-08 20:05:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Tinokil",
"github_project": "tinLogging",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tinlogging"
}