Metadata-Version: 2.4
Name: hmlogger
Version: 0.0.1
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
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 (lokal)

Direkt aus dem Repository:

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

Bis zur PyPI-Veroeffentlichung kann das Modul lokal so verwendet werden:

```python
import HmLogger
```

## 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()

## PyPI-Veroeffentlichung (Schritt fuer Schritt)

1. Paket-Metadaten anlegen

   - Datei pyproject.toml erstellen
   - mind. name, version, description, readme, requires-python, authors setzen
   - Build-Backend definieren (z. B. hatchling oder setuptools)

2. Lizenzdatei hinzufuegen

   - Datei LICENSE erstellen (z. B. MIT)
   - Lizenz in pyproject.toml referenzieren

3. Paketstruktur pruefen

   - sicherstellen, dass das importierbare Paket korrekt gefunden wird
   - Paketname auf PyPI: hmlogger
   - Import-Name im Code: HmLogger

4. Build-Werkzeuge installieren

```bash
python -m pip install --upgrade build twine
```

5. Paket bauen

```bash
python -m build
```

Ergebnis liegt in dist/ (sdist und wheel).

6. Artefakte pruefen

```bash
python -m twine check dist/*
```

7. Test-Upload zu TestPyPI

```bash
python -m twine upload --repository testpypi dist/*
```

8. Installation von TestPyPI pruefen

```bash
pip install --index-url https://test.pypi.org/simple/ hmlogger
```

9. Upload zu PyPI

```bash
python -m twine upload dist/*
```

10. Release taggen

   - Version in pyproject.toml erhoehen
   - Git-Tag setzen und veroeffentlichen

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

## Lizenz

Dieses Projekt steht unter der MIT License.
