Metadata-Version: 2.4
Name: vieuxhibou-django
Version: 1.2.0.dev0
Summary: Logging structuré, registre de loggers modifiables à chaud et enregistrement auprès de vieuxhibou pour les projets Django
License: LGPL-3.0-or-later
Project-URL: Homepage, https://git.stationmyr.net/Gilles/vieuxhibou-django
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: COPYING
License-File: COPYING.LESSER
Requires-Dist: Django>=4.2
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-django; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2; extra == "docs"
Requires-Dist: myst-parser>=3; extra == "docs"
Dynamic: license-file

<img src="docs/logo.svg" alt="" width="96" height="96">

# vieuxhibou-django

[![CI](https://git.stationmyr.net/Gilles/vieuxhibou-django/badges/workflows/ci.yml/badge.svg?branch=master)](https://git.stationmyr.net/Gilles/vieuxhibou-django/actions?workflow=ci.yml)
[![Coverage](https://reports.stationmyr.net/Gilles/vieuxhibou-django/branch/master/badge/cobertura.svg?aggregate=1)](https://reports.stationmyr.net/Gilles/vieuxhibou-django/branch/master/cobertura)
[![Tests](https://reports.stationmyr.net/Gilles/vieuxhibou-django/branch/master/badge/junit.svg?aggregate=1)](https://reports.stationmyr.net/Gilles/vieuxhibou-django/branch/master/junit)
[![License: LGPL v3](https://img.shields.io/badge/license-LGPLv3-blue.svg)](COPYING.LESSER)

Structured logging for Django: a registry of already-instantiated Python
loggers, hot-reloadable (NOTSET/DEBUG/INFO/WARNING/ERROR/CRITICAL level,
no process restart needed), plus optional registration/heartbeat with a
central **vieuxhibou** server to drive those levels remotely from a
dashboard shared with
[vieuxhibou-gin](https://git.stationmyr.net/Gilles/vieuxhibou-gin)
services.

## Installation

```bash
pip install vieuxhibou-django
```

```python
# settings.py
INSTALLED_APPS = [
    ...,
    "vieuxhibou",
]

VIEUXHIBOU_SERVICE_NAME = "my-service"
VIEUXHIBOU_ENV = "prod"
VIEUXHIBOU_VERSION = "1.2.3"

# Optional: registration with a central vieuxhibou server.
# Leaving this empty disables registration/heartbeat (the logger
# registry stays usable locally either way).
VIEUXHIBOU_SERVER_URL = "https://vieuxhibou.example.org"
VIEUXHIBOU_SELF_URL = "https://my-service.example.org"
VIEUXHIBOU_SHARED_TOKEN = "..."
VIEUXHIBOU_HEARTBEAT_INTERVAL = 30  # seconds
```

```bash
python manage.py migrate
```

The `vieuxhibou.urls` routes (dashboard + `/loggers/` API) need to be
mounted into the host project's urlconf, for example:

```python
# urls.py
urlpatterns = [
    ...,
    path("vieuxhibou/", include("vieuxhibou.urls")),
]
```

Level changes applied through the API are persisted (`LoggerOverride`)
and automatically reapplied the next time the process starts.

## Development

```bash
make dev            # venv + pip install -e ".[dev]"
make test           # pytest, via tox
make lint           # pylint (+ pylint-django)
make format-check   # autopep8 --diff (CI)
make format         # autopep8 --in-place (local)
make bandit         # static security analysis
make tox            # all tox environments at once
```

## License

LGPLv3, see [COPYING](COPYING) + [COPYING.LESSER](COPYING.LESSER) --
chosen over GPLv3 specifically because this package is meant to be
imported (i.e. "linked", in the LGPL sense) by projects that have no
reason of their own to be GPL.
