# SIBRA Logger
SIBRA Logger is an configurable logging library designed for Python applications. It supports dynamic configuration reloading, structured logging for seamless integration into any project.
---
## Features
1. **Dynamic Configuration Reloading**:
- Automatically monitors and reloads logging configurations without restarting the application.
---
## Installation
### Prerequisites
- Python 3.6 or higher.
### Install the Package
```
pip install sibra_logger
```
# Install Development Dependencies (Optional)
To install dependencies for development and testing:
```
pip install sibra_logger[dev]
```
# Usage
## Basic Setup
1. Initialize Logging in Your Application
```
from sibra_logger import setup_logging, start_logging_monitor
# Set up logging
setup_logging()
# Start monitoring configuration changes
start_logging_monitor()
```
2. Log Messages
```
import logging
logger = logging.getLogger(__name__)
logger.info("This is an informational message.")
logger.debug("This is a debug message.")
logger.error("This is an error message.")
```
## Using a Custom Configuration File
Pass a custom configuration file path to setup_logging:
```
setup_logging("path/to/custom_config.yaml")
```
## Storing configuration file as env variable
This logger support storing env variable SIBRA_LOG_CONFIG & pulls the config file from env variable as well.
# Configuration
The logging behavior is controlled via a YAML configuration file (log_config.yaml).
## Example Configuration
```
version: 1
disable_existing_loggers: false
formatters:
detailed:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s [Line: %(lineno)d]'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: detailed
stream: ext://sys.stdout
rotating_file:
class: logging.handlers.RotatingFileHandler
level: INFO
formatter: detailed
filename: logs/rotating_app.log
maxBytes: 10485760
backupCount: 5
encoding: utf8
root:
level: INFO
handlers: [console, rotating_file]
```
# Dependencies
## Required
pyyaml: For YAML configuration.
#Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a feature branch.
3. Commit your changes and submit a pull request.
# License
This project is licensed under the MIT License. See LICENSE for more details.
This README.md reflects the features and functionality of your package, organized to be user-friendly and professional.
Let me know if you'd like any additional adjustments!
Raw data
{
"_id": null,
"home_page": "https://github.com/primabonito/sibralogger",
"name": "sibra-logger",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "logging python configurable logging yaml configuration",
"author": "Ashraf Inamdar",
"author_email": "ashrafinamdar@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bf/6e/ca0f075d0b8bb080c5832f6df7cd278bb97fdfa215d39d779ab324985d36/sibra_logger-1.0.0.tar.gz",
"platform": null,
"description": "# SIBRA Logger\r\n\r\nSIBRA Logger is an configurable logging library designed for Python applications. It supports dynamic configuration reloading, structured logging for seamless integration into any project.\r\n\r\n---\r\n\r\n## Features\r\n\r\n1. **Dynamic Configuration Reloading**:\r\n - Automatically monitors and reloads logging configurations without restarting the application.\r\n\r\n\r\n\r\n---\r\n\r\n## Installation\r\n\r\n### Prerequisites\r\n\r\n- Python 3.6 or higher.\r\n\r\n### Install the Package\r\n\r\n```\r\npip install sibra_logger\r\n\r\n```\r\n\r\n# Install Development Dependencies (Optional)\r\n To install dependencies for development and testing:\r\n\r\n```\r\npip install sibra_logger[dev]\r\n```\r\n\r\n# Usage\r\n## Basic Setup\r\n 1. Initialize Logging in Your Application\r\n\r\n```\r\nfrom sibra_logger import setup_logging, start_logging_monitor\r\n\r\n# Set up logging\r\nsetup_logging()\r\n\r\n# Start monitoring configuration changes\r\nstart_logging_monitor()\r\n```\r\n\r\n 2. Log Messages\r\n\r\n```\r\nimport logging\r\n\r\nlogger = logging.getLogger(__name__)\r\n\r\nlogger.info(\"This is an informational message.\")\r\nlogger.debug(\"This is a debug message.\")\r\nlogger.error(\"This is an error message.\")\r\n```\r\n## Using a Custom Configuration File\r\nPass a custom configuration file path to setup_logging:\r\n\r\n```\r\nsetup_logging(\"path/to/custom_config.yaml\")\r\n```\r\n\r\n## Storing configuration file as env variable\r\nThis logger support storing env variable SIBRA_LOG_CONFIG & pulls the config file from env variable as well.\r\n\r\n# Configuration\r\nThe logging behavior is controlled via a YAML configuration file (log_config.yaml).\r\n\r\n## Example Configuration\r\n```\r\nversion: 1\r\ndisable_existing_loggers: false\r\n\r\nformatters:\r\n detailed:\r\n format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s [Line: %(lineno)d]'\r\n datefmt: '%Y-%m-%d %H:%M:%S'\r\n\r\n\r\nhandlers:\r\n console:\r\n class: logging.StreamHandler\r\n level: DEBUG\r\n formatter: detailed\r\n stream: ext://sys.stdout\r\n rotating_file:\r\n class: logging.handlers.RotatingFileHandler\r\n level: INFO\r\n formatter: detailed\r\n filename: logs/rotating_app.log\r\n maxBytes: 10485760\r\n backupCount: 5\r\n encoding: utf8\r\n\r\n\r\nroot:\r\n level: INFO\r\n handlers: [console, rotating_file]\r\n```\r\n\r\n\r\n\r\n\r\n\r\n# Dependencies\r\n## Required\r\npyyaml: For YAML configuration.\r\n\r\n\r\n#Contributing\r\nContributions are welcome! Please follow these steps:\r\n\r\n1. Fork the repository.\r\n2. Create a feature branch.\r\n3. Commit your changes and submit a pull request.\r\n\r\n# License\r\nThis project is licensed under the MIT License. See LICENSE for more details.\r\n\r\nThis README.md reflects the features and functionality of your package, organized to be user-friendly and professional. \r\nLet me know if you'd like any additional adjustments!\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Configurable logging for Python applications",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/primabonito/sibralogger"
},
"split_keywords": [
"logging",
"python",
"configurable",
"logging",
"yaml",
"configuration"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca60b38bc252b36d6d2aa8cc7ae7757169f7491587f0557d2f843d62359871b7",
"md5": "5346febf66cb67ffdd123cd6732f9aea",
"sha256": "8d519deaa69adbb30d6bba0adc8e7528c1b8ee806aa56ba5c58be2d9fd8ab461"
},
"downloads": -1,
"filename": "sibra_logger-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5346febf66cb67ffdd123cd6732f9aea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8040,
"upload_time": "2024-12-10T10:32:24",
"upload_time_iso_8601": "2024-12-10T10:32:24.889473Z",
"url": "https://files.pythonhosted.org/packages/ca/60/b38bc252b36d6d2aa8cc7ae7757169f7491587f0557d2f843d62359871b7/sibra_logger-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bf6eca0f075d0b8bb080c5832f6df7cd278bb97fdfa215d39d779ab324985d36",
"md5": "8e9a5d7d56a3fc0f0a1fb265258aec11",
"sha256": "69ca152a39a73e2b63e38d41f341c17efe471472dadaf35dd3ebdb20be434e1e"
},
"downloads": -1,
"filename": "sibra_logger-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "8e9a5d7d56a3fc0f0a1fb265258aec11",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6178,
"upload_time": "2024-12-10T10:32:27",
"upload_time_iso_8601": "2024-12-10T10:32:27.284323Z",
"url": "https://files.pythonhosted.org/packages/bf/6e/ca0f075d0b8bb080c5832f6df7cd278bb97fdfa215d39d779ab324985d36/sibra_logger-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 10:32:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "primabonito",
"github_project": "sibralogger",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pyyaml",
"specs": [
[
">=",
"5.4"
]
]
}
],
"lcname": "sibra-logger"
}