Metadata-Version: 2.4
Name: pretty-loguru
Version: 0.1.0
Summary: A Loguru-based logger with Rich panels, ASCII art headers, blocks and more.
Author-email: JonesHong <latte831104@gmail.com>
License: MIT License
        
        Copyright (c) 2025 JonesHong
        
        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: Source, https://github.com/JonesHong/pretty-loguru
Project-URL: Tracker, https://github.com/JonesHong/pretty-loguru/issues
Keywords: logging,loguru,rich,ascii,art
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: loguru>=0.6.0
Requires-Dist: rich>=12.0.0
Requires-Dist: art>=5.0.0
Dynamic: license-file

# pretty-loguru

[![PyPI version](https://img.shields.io/pypi/v/pretty-loguru.svg)](https://pypi.org/project/pretty-loguru)
[![Python Version](https://img.shields.io/pypi/pyversions/pretty-loguru.svg)]

## Description

**pretty-loguru** is a Python logging library that extends the power of [Loguru](https://github.com/Delgan/loguru) with elegant outputs using [Rich](https://github.com/Textualize/rich) panels, ASCII art headers, and customizable blocks. It provides:

- **Rich Panels**: Display structured log blocks with borders and styles.
- **ASCII Art Headers**: Generate eye-catching headers using the `art` library.
- **ASCII Blocks**: Combine ASCII art and block logs for comprehensive sections.
- **Easy Initialization**: One-call setup for both file and console logging.
- **Uvicorn Integration**: Intercept and unify Uvicorn logs with Loguru formatting.

## Installation

Install via pip:

```bash
pip install pretty-loguru
```

## Quick Start

```python
from pretty_loguru import logger, logger_start

# Initialize the logger (creates file handler + console handler)
process_id = logger_start(folder="my_app")
logger.info("Logger initialized.")

# Basic logging
logger.debug("Debug message.")
logger.success("Operation was successful.")
logger.warning("This is a warning.")
logger.error("An error occurred.")
```

## Features

### Rich Block Logging

```python
logger.block(
    "System Summary",
    [
        "CPU Usage: 45%",
        "Memory Usage: 60%",
        "Disk Space: 120GB free"
    ],
    border_style="green",
    log_level="INFO"
)
```

### ASCII Art Headers

```python
logger.ascii_header(
    "APP START",
    font="slant",
    border_style="blue",
    log_level="INFO"
)
```

### ASCII Art Blocks

```python
logger.ascii_block(
    "Startup Report",
    ["Step 1: OK", "Step 2: OK", "Step 3: OK"],
    ascii_header="SYSTEM READY",
    ascii_font="small",
    border_style="cyan",
    log_level="SUCCESS"
)
```

### Uvicorn Integration

```python
from pretty_loguru import uvicorn_init_config
uvicorn_init_config()
```

## Configuration

Customize file path, rotation, and level:

```python
from pretty_loguru import init_logger

init_logger(
    level="DEBUG",
    log_path="logs",
    process_id="my_app",
    rotation="10MB"
)
```

## Testing

Run the test suite:

```bash
pytest tests/
```

## Contributing

Contributions welcome! Please open issues and pull requests on [GitHub](https://github.com/yourusername/pretty-loguru).

## License

This project is licensed under the [MIT License](LICENSE).

