| Name | apv JSON |
| Version |
4.2.0
JSON |
| download |
| home_page | https://github.com/acidvegas/apv |
| Summary | Advanced Python Logging |
| upload_time | 2025-09-15 03:04:34 |
| maintainer | None |
| docs_url | None |
| author | acidvegas |
| requires_python | None |
| license | ISC |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Advanced Python Logging (APV)
> Flexible & powerful logging solution for Python applications

## Table of Contents
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Features](#features)
- [Configuration Options](#configuration-options)
- [Usage](#usage)
- [Basic Console Logging](#basic-console-logging)
- [Console Logging with Details](#console-logging-with-details)
- [File Logging with Rotation](#file-logging-with-rotation)
- [File Logging with Compression and JSON Format](#file-logging-with-compression-and-json-format)
- [Mixing it all together](#mixing-it-all-together)
## Introduction
APV emerged from a simple observation: despite the abundance of logging solutions, there's a glaring lack of standardization in application logging. APV is my response to this challenge – a logging library that doesn't aim to revolutionize the field, but rather to streamline it.
## Requirements
- Python 3
## Installation
### From PyPI
```bash
pip install apv
```
### From Source
```bash
git clone https://github.com/acidvegas/apv
cd apv
pip install .
```
## Features
- **Console Logging with Colors**: Enhanced readability with colored log messages in the console.
- **File Logging**: Write logs to files with support for log rotation based on size and number of backups.
- **Log Compression**: Automatically compress old log files using gzip to save disk space.
- **JSON Logging**: Output logs in JSON format for better structure and integration with log management systems.
- **Syslog Capabilities**: Out logs (optionally in JSON) to the machines syslog.
- **Detailed Log Messages**: Option to include module name, function name, and line number in log messages.
## Configuration Options
The `setup_logging` function accepts the following keyword arguments to customize logging behavior:
| Name | Default | Description |
|-------------------|--------------------------|-------------------------------------------------------------------------------|
| `level` | `INFO` | The logging level. *(`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`)* |
| `date_format` | `'%Y-%m-%d %H:%M:%S'` | The date format for log messages. |
| `log_to_disk` | `False` | Whether to log to disk. |
| `max_log_size` | `10*1024*1024` *(10 MB)* | The maximum size of log files before rotation *(in bytes)*. |
| `max_backups` | `7` | The maximum number of backup log files to keep. |
| `log_file_name` | `'app'` | The base name of the log file. |
| `json_log` | `False` | Whether to log in JSON format. |
| `show_details` | `False` | Whether to include module name, function name, & line number in log messages. |
| `compress_backups`| `False` | Whether to compress old log files using gzip. |
| `syslog` | `False` | Whether to send logs to syslog. |
## Usage
### Basic Console Logging
```python
import logging
import apv
# Set up basic console logging
apv.setup_logging(level='INFO')
logging.info('This is an info message.')
logging.error('This is an error message.')
```
### Console Logging with Details
```python
import logging
import apv
# Set up console logging with detailed information
apv.setup_logging(level='DEBUG', show_details=True)
logging.debug('Debug message with details.')
```
### File Logging with Rotation
```python
import logging
import apv
# Set up file logging with log rotation
apv.setup_logging(
level='INFO',
log_to_disk=True,
max_log_size=10*1024*1024, # 10 MB
max_backups=5,
log_file_name='application_log'
)
logging.info('This message will be logged to a file.')
```
### File Logging with Compression and JSON Format
```python
import logging
import apv
# Set up file logging with compression and JSON format
apv.setup_logging(
level='DEBUG',
log_to_disk=True,
max_log_size=5*1024*1024, # 5 MB
max_backups=7,
log_file_name='json_log',
json_log=True,
compress_backups=True
)
logging.debug('This is a debug message in JSON format.')
```
### Syslog Logging
```python
import logging
import apv
# Set up syslog logging
apv.setup_logging(level='INFO', syslog=True)
logging.info('This message will be sent to syslog.')
logging.error('Error messages are also sent to syslog.')
```
### Syslog Logging with JSON Format
```python
import logging
import apv
# Set up syslog logging with JSON format
apv.setup_logging(level='DEBUG', syslog=True, json_log=True)
logging.debug('This debug message will be sent to syslog in JSON format.')
logging.info('Info messages are also sent as JSON to syslog.')
```
### Syslog Logging with Details
```python
import logging
import apv
# Set up syslog logging with detailed information
apv.setup_logging(level='DEBUG', syslog=True, show_details=True)
logging.debug('This debug message will include module, function, and line details in syslog.')
```
### Mixing it all together
```python
import logging
import apv
# Set up logging to all handlers
apv.setup_logging(
level='DEBUG',
log_to_disk=True,
max_log_size=10*1024*1024,
max_backups=7,
log_file_name='app',
json_log=True,
compress_backups=True,
show_details=True,
syslog=True
)
```
---
###### Mirrors: [acid.vegas](https://git.acid.vegas/apv) • [SuperNETs](https://git.supernets.org/acidvegas/apv) • [GitHub](https://github.com/acidvegas/apv) • [GitLab](https://gitlab.com/acidvegas/apv) • [Codeberg](https://codeberg.org/acidvegas/apv)
Raw data
{
"_id": null,
"home_page": "https://github.com/acidvegas/apv",
"name": "apv",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "acidvegas",
"author_email": "acid.vegas@acid.vegas",
"download_url": "https://files.pythonhosted.org/packages/41/19/e000d565927cea843b1197877e2b8df4cac5ec066483f7e1b34a045ac460/apv-4.2.0.tar.gz",
"platform": null,
"description": "# Advanced Python Logging (APV)\n> Flexible & powerful logging solution for Python applications\n\n\n\n## Table of Contents\n- [Introduction](#introduction)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Features](#features)\n- [Configuration Options](#configuration-options)\n- [Usage](#usage)\n - [Basic Console Logging](#basic-console-logging)\n - [Console Logging with Details](#console-logging-with-details)\n - [File Logging with Rotation](#file-logging-with-rotation)\n - [File Logging with Compression and JSON Format](#file-logging-with-compression-and-json-format)\n - [Mixing it all together](#mixing-it-all-together)\n\n## Introduction\nAPV emerged from a simple observation: despite the abundance of logging solutions, there's a glaring lack of standardization in application logging. APV is my response to this challenge \u2013 a logging library that doesn't aim to revolutionize the field, but rather to streamline it.\n\n## Requirements\n- Python 3\n\n## Installation\n\n### From PyPI\n```bash\npip install apv\n```\n\n### From Source\n```bash\ngit clone https://github.com/acidvegas/apv\ncd apv\npip install .\n```\n\n## Features\n- **Console Logging with Colors**: Enhanced readability with colored log messages in the console.\n- **File Logging**: Write logs to files with support for log rotation based on size and number of backups.\n- **Log Compression**: Automatically compress old log files using gzip to save disk space.\n- **JSON Logging**: Output logs in JSON format for better structure and integration with log management systems.\n- **Syslog Capabilities**: Out logs (optionally in JSON) to the machines syslog.\n- **Detailed Log Messages**: Option to include module name, function name, and line number in log messages.\n\n## Configuration Options\n\nThe `setup_logging` function accepts the following keyword arguments to customize logging behavior:\n\n| Name | Default | Description |\n|-------------------|--------------------------|-------------------------------------------------------------------------------|\n| `level` | `INFO` | The logging level. *(`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`)* |\n| `date_format` | `'%Y-%m-%d %H:%M:%S'` | The date format for log messages. |\n| `log_to_disk` | `False` | Whether to log to disk. |\n| `max_log_size` | `10*1024*1024` *(10 MB)* | The maximum size of log files before rotation *(in bytes)*. |\n| `max_backups` | `7` | The maximum number of backup log files to keep. |\n| `log_file_name` | `'app'` | The base name of the log file. |\n| `json_log` | `False` | Whether to log in JSON format. |\n| `show_details` | `False` | Whether to include module name, function name, & line number in log messages. |\n| `compress_backups`| `False` | Whether to compress old log files using gzip. |\n| `syslog` | `False` | Whether to send logs to syslog. |\n\n## Usage\n\n### Basic Console Logging\n\n```python\nimport logging\nimport apv\n\n# Set up basic console logging\napv.setup_logging(level='INFO')\n\nlogging.info('This is an info message.')\nlogging.error('This is an error message.')\n```\n\n### Console Logging with Details\n\n```python\nimport logging\nimport apv\n\n# Set up console logging with detailed information\napv.setup_logging(level='DEBUG', show_details=True)\n\nlogging.debug('Debug message with details.')\n```\n\n### File Logging with Rotation\n\n```python\nimport logging\nimport apv\n\n# Set up file logging with log rotation\napv.setup_logging(\n level='INFO',\n log_to_disk=True,\n max_log_size=10*1024*1024, # 10 MB\n max_backups=5,\n log_file_name='application_log'\n)\n\nlogging.info('This message will be logged to a file.')\n```\n\n### File Logging with Compression and JSON Format\n\n```python\nimport logging\nimport apv\n\n# Set up file logging with compression and JSON format\napv.setup_logging(\n level='DEBUG',\n log_to_disk=True,\n max_log_size=5*1024*1024, # 5 MB\n max_backups=7,\n log_file_name='json_log',\n json_log=True,\n compress_backups=True\n)\n\nlogging.debug('This is a debug message in JSON format.')\n```\n\n### Syslog Logging\n\n```python\nimport logging\nimport apv\n\n# Set up syslog logging\napv.setup_logging(level='INFO', syslog=True)\n\nlogging.info('This message will be sent to syslog.')\nlogging.error('Error messages are also sent to syslog.')\n```\n\n### Syslog Logging with JSON Format\n\n```python\nimport logging\nimport apv\n\n# Set up syslog logging with JSON format\napv.setup_logging(level='DEBUG', syslog=True, json_log=True)\n\nlogging.debug('This debug message will be sent to syslog in JSON format.')\nlogging.info('Info messages are also sent as JSON to syslog.')\n```\n\n### Syslog Logging with Details\n\n```python\nimport logging\nimport apv\n\n# Set up syslog logging with detailed information\napv.setup_logging(level='DEBUG', syslog=True, show_details=True)\n\nlogging.debug('This debug message will include module, function, and line details in syslog.')\n```\n\n\n### Mixing it all together\n\n```python\nimport logging\nimport apv\n\n# Set up logging to all handlers\napv.setup_logging(\n level='DEBUG',\n log_to_disk=True,\n max_log_size=10*1024*1024,\n max_backups=7,\n log_file_name='app',\n json_log=True,\n compress_backups=True,\n show_details=True,\n syslog=True\n)\n```\n\n---\n\n###### Mirrors: [acid.vegas](https://git.acid.vegas/apv) \u2022 [SuperNETs](https://git.supernets.org/acidvegas/apv) \u2022 [GitHub](https://github.com/acidvegas/apv) \u2022 [GitLab](https://gitlab.com/acidvegas/apv) \u2022 [Codeberg](https://codeberg.org/acidvegas/apv)\n",
"bugtrack_url": null,
"license": "ISC",
"summary": "Advanced Python Logging",
"version": "4.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/acidvegas/apv/issues",
"Documentation": "https://github.com/acidvegas/apv/wiki",
"Homepage": "https://github.com/acidvegas/apv",
"Source Code": "https://github.com/acidvegas/apv"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "70123527316be40442cc5a7c37bf14f46a18c93988c9e312afdbfdced9a1ab7c",
"md5": "a2a51241b106d027374af6c1d21f4c7f",
"sha256": "aa8b67d1be4f2d26aaba52128dec58277949fb5ca6a1d6e425e1dcf96d4b9fa9"
},
"downloads": -1,
"filename": "apv-4.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2a51241b106d027374af6c1d21f4c7f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6686,
"upload_time": "2025-09-15T03:04:33",
"upload_time_iso_8601": "2025-09-15T03:04:33.478427Z",
"url": "https://files.pythonhosted.org/packages/70/12/3527316be40442cc5a7c37bf14f46a18c93988c9e312afdbfdced9a1ab7c/apv-4.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4119e000d565927cea843b1197877e2b8df4cac5ec066483f7e1b34a045ac460",
"md5": "dc4a745551af6c5d04ea461c9f2307a0",
"sha256": "af921a6770aa7d82e320fa7aceb1b2049596ca5b216ff93d6941ec4945c7b059"
},
"downloads": -1,
"filename": "apv-4.2.0.tar.gz",
"has_sig": false,
"md5_digest": "dc4a745551af6c5d04ea461c9f2307a0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6606,
"upload_time": "2025-09-15T03:04:34",
"upload_time_iso_8601": "2025-09-15T03:04:34.344464Z",
"url": "https://files.pythonhosted.org/packages/41/19/e000d565927cea843b1197877e2b8df4cac5ec066483f7e1b34a045ac460/apv-4.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-15 03:04:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "acidvegas",
"github_project": "apv",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "apv"
}