Metadata-Version: 2.1
Name: sibra_logger
Version: 1.0.0
Summary: Configurable logging for Python applications
Home-page: https://github.com/primabonito/sibralogger
Author: Ashraf Inamdar
Author-email: ashrafinamdar@gmail.com
License: MIT
Keywords: logging python configurable logging yaml configuration
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml>=5.4.1
Provides-Extra: dev
Requires-Dist: pytest>=6.2.5; extra == "dev"
Requires-Dist: pytest-mock>=3.6.1; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"

# 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!

