Metadata-Version: 2.4
Name: HmLogger
Version: 0.0.2
Summary: Lightweight Python logger with colored output, rotating file logging, and optional async queue logging.
Author: Ps394
License: MIT License
        
        Copyright (c) 2026 Ps394
        
        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/Ps394/hmlogger
Project-URL: Repository, https://github.com/Ps394/hmlogger
Project-URL: Issues, https://github.com/Ps394/hmlogger/issues
Keywords: logging,logger,colored-output,rotating-file-handler,async-logging
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Logging
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
Dynamic: license-file

# HmLogger

Ein leichtgewichtiges Logging-Modul fuer Python mit:

- farbiger Konsolen-Ausgabe
- optionalem Rotating-File-Logging
- optionalem asynchronen Logging ueber QueueHandler und QueueListener

## Voraussetzungen

- Python 3.11 oder neuer

Hinweis: Das Projekt verwendet typing.Self und Union-Typen mit |.

## Installation

**Von PyPI (empfohlen):**

```bash
pip install hmlogger
```

**Lokal aus dem Repository:**

```bash
pip install -e .
```

**Mit Test-Abhaengigkeiten:**

```bash
pip install -e .[test]
```

Nach der Installation:

```python
from HmLogger import setup_logging, get_logger
import logging

setup_logging(level=logging.INFO)
log = get_logger(__name__)
log.info("Hello World")
```

## Schnellstart

```python
import logging
from HmLogger import setup_logging, get_logger

setup_logging(
    level=logging.DEBUG,
    use_colors=True,
    file_logging=True,
    async_logging=True,
)

log = get_logger("App")
log.debug("Debug-Nachricht")
log.info("Info-Nachricht")
log.warning("Warnung")
log.error("Fehler")
log.critical("Kritischer Fehler")
```

## API

### setup_logging(...)

```python
setup_logging(
    level=logging.INFO,
    use_colors=True,
    file_logging=True,
    async_logging=True,
    log_folder="./logs",
    log_file="app.log",
    mb=5,
    backup_count=5,
)
```

Parameter:

- level: Log-Level (z. B. logging.DEBUG)
- use_colors: ANSI-Farben fuer Konsole aktivieren
- file_logging: Log-Ausgabe in Datei aktivieren
- async_logging: Queue-basiertes, nicht blockierendes Logging
- log_folder: Zielordner fuer Log-Dateien
- log_file: Dateiname der Haupt-Logdatei
- mb: maximale Dateigroesse in MB vor Rotation
- backup_count: Anzahl aufbewahrter Rotationsdateien

### get_logger(name)

```python
from HmLogger import get_logger

log = get_logger("MyService")
log.info("Service gestartet")
```

## Farben und Styles

```python
from HmLogger import Color, Text

print(Color("green")("Erfolg"))
print(Color("red").bold()("Fehler"))
print(Color("yellow").underline()("Achtung"))
print(Text("Custom Text", Color("magenta").italic()))
```

Verfuegbare Farben:

- default
- grey
- red
- green
- yellow
- blue
- magenta
- cyan
- white

Verfuegbare Styles:

- bold()
- dim()
- italic()
- underline()
- blink()
- reversed()
- strikethrough()
- intense()


## Hinweise

- Bei aktivem async_logging wird ein QueueListener verwendet und per atexit sauber beendet.
- Bei file_logging=True werden Dateien rotiert, sobald die konfigurierte Groesse erreicht ist.

## Tests

Tests liegen im Ordner `tests/`.

```bash
python -m pytest
```

Die Test-Abhaengigkeiten sind als optionales Extra `test` in `pyproject.toml` hinterlegt.

## CI

Ein GitHub-Actions-Workflow unter `.github/workflows/ci.yml` fuehrt die Tests bei Push und Pull Requests nach `main` auf Python 3.11 bis 3.13 aus.

## Lizenz

Dieses Projekt steht unter der MIT License.
