Metadata-Version: 2.4
Name: negogv-log
Version: 0.1.7
Summary: A custom Python logger configuration with colored console output.
Author-email: Daniel Weber <daniel.tk@tuta.io>
License: MIT License
        
        Copyright (c) 2025 Daniel Weber
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/negogv/negogv_logger
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# negogv-log

A lightweight, colorized Python logger configuration designed for quick integration and high readability. This package provides a pre-configured logger that handles both console and file output with sensible defaults.

## Features

- **🎨 Colorized Console Output**: Enhanced readability with level-specific colors.
- **📁 Split File Logging**: Automatically separates logs into:
    - `high_lvl.log`: Warnings, Errors, and Critical messages.
    - `low_lvl.log`: Debug and Info messages.
- **📄 Multiline Support**: File logs automatically indent multiline messages for better formatting.
- **🔍 File Origin Tracking**: Includes filename and line numbers in logs to easily identify source locations.
- **🛠️ Exception Helper**: `log_exception` for quick, colorized exception reporting.
- **🚫 Level Filtering**: Easily exclude specific log levels from the console.

## Installation

```bash
pip install negogv-log
```

## Quick Start

```python
from negogv_log import setup_logger

# Initialize the logger with a directory for log files
logger = setup_logger(log_dir="logs")

logger.debug("This is a debug message")
logger.info("Application started")
logger.warning("Something might be wrong")
logger.error("An error occurred")
logger.critical("System failure!")
```

## Advanced Usage

### Excluding Console Levels

You can exclude specific levels from being printed to the console:

```python
# Exclude only INFO logs from console
logger = setup_logger(log_dir="logs", exclude_console="INFO")

# Exclude multiple levels
logger = setup_logger(log_dir="logs", exclude_console=["DEBUG", "INFO"])
```

### Exception Logging

Use `log_exception` to print a concise, colorized summary of an exception:

```python
from negogv_log import log_exception

try:
    1 / 0
except Exception as e:
    log_exception(e)
```

### Multiline Messages

The file logger handles multiline strings gracefully by indenting subsequent lines:

```python
logger.info("This is a\nmulti-line\nmessage")
```

## Configuration

The `setup_logger` function performs the following:
1. Creates the specified `log_dir` if it doesn't exist.
2. Sets up a `StreamHandler` for console output with `CustomFormatter` (colors).
3. Sets up two `FileHandlers`:
    - `high_lvl.log` (Level >= WARNING)
    - `low_lvl.log` (Level <= INFO)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
