Run examples from the repository root after installing Logust in editable mode:
maturin develop
python examples/01_basic_logging.py01_basic_logging.py: levels and basic message formatting02_file_output.py: files, rotation, retention, compression, async writes03_json_serialization.py: JSON logs and parsing JSON logs back04_context_binding.py:bind()andcontextualize()05_exception_handling.py: exceptions,catch(),opt(exception=True)06_custom_levels.py: custom level names, colors, and filtering07_callbacks.py: callbacks for metrics, alerts, and external services08_fastapi_integration.py: FastAPI canonical request events and tail sampling
Install the web extra and uvicorn:
pip install "logust[fastapi]" uvicorn
python examples/08_fastapi_integration.pyTry a few requests:
curl -H "x-request-id: req-demo" "http://localhost:8000/users/123?plan=pro"
curl -X POST "http://localhost:8000/checkout?user_id=u_123"
curl "http://localhost:8000/error"The example writes canonical JSON request events to logs/app.json.