Lumax is a lightweight Python logging library designed to bring clarity and visibility to application behavior through structured, developer-friendly logs.
Project description
lumax
A lightweight structured logging framework for modern Python.
lumax focuses on composable logging pipelines, immutable events, structured fields, and sink-based extensibility.
Features
- Structured logging
- Immutable event model
- Composable sink pipeline
- Filtering support
- Field transformation system
- Include / exclude / redact support
- JSON serialization
- Console logging
- File logging
- HTTP logging
- Easy integration with Promtail, Loki, and other observability stacks
- Type-safe architecture
- Minimal and extensible design
Installation
pip install lumax
Overview
lumax is built around four core concepts:
| Concept | Responsibility |
|---|---|
| Event | Immutable log payload |
| Identity | Metadata describing the source |
| Sink | Output destination |
| Transform | Field projection and redaction |
The logging pipeline is intentionally simple:
Logger
→ FilterSink
→ TransformSink
→ Output Sink
Quick Start
Basic Logger
from lumax.core.identity import Identity
from lumax.core.level import Level
from lumax.logger import Logger
from lumax.sinks.console import ConsoleSink
logger = Logger(
identity=Identity(
environment="development",
service="api",
type="application",
),
sinks=[ConsoleSink()],
)
logger.info(
"User authenticated",
user_id=123,
provider="github",
)
Example Output
{
"timestamp": "2026-05-22T10:00:00+00:00",
"level": "INFO",
"identity": {
"environment": "development",
"service": "api",
"type": "application"
},
"message": "User authenticated",
"fields": {
"user_id": 123,
"provider": "github"
}
}
Core Concepts
Identity
Identity describes where a log event originates from.
from lumax.core.identity import Identity
identity = Identity(
environment="production",
service="billing",
type="service",
)
Fields
| Field | Description |
|---|---|
| environment | Runtime environment |
| service | Service or application name |
| type | Logger category |
| labels | Additional structured metadata |
Event
Every emitted log becomes an immutable Event.
from lumax.core.event import Event
An event contains:
- timestamp
- level
- identity
- message
- fields
Levels
from lumax.core.level import Level
Available levels:
- DEBUG
- INFO
- WARNING
- ERROR
- CRITICAL
Sinks
Sinks are responsible for outputting log events.
ConsoleSink
from lumax.sinks.console import ConsoleSink
Outputs logs to stdout.
FileSink
from lumax.sinks.file import FileSink
Writes logs to files.
Example
from lumax.sinks.file import FileSink
sink = FileSink(
dir="./logs",
)
If no filename is provided, lumax automatically generates one using the current UTC timestamp.
Example:
2026-05-22_10-00-00.log
HTTPSink
from lumax.sinks.http import HTTPSink
Sends logs to HTTP endpoints using httpx.
Example
import httpx
from lumax.sinks.http import HTTPSink
client = httpx.Client(
base_url="https://example.com",
headers={
"Authorization": "Bearer token"
},
)
sink = HTTPSink(
client=client,
url="/logs",
)
Filtering
Filtering controls whether an event should be emitted.
from lumax.core.filter import Filter
from lumax.sinks.filtering import FilterSink
from lumax.core.level import Level
Example
sink = FilterSink(
sink=ConsoleSink(),
filter=Filter(
level=Level.INFO,
types=frozenset({"application"}),
),
)
Transformations
Transformations reshape event fields before emission.
lumax supports:
- include
- exclude
- redact
The transformation system mirrors Pydantic's include/exclude behavior.
Include
from lumax.core.transform import Transform
transform = Transform(
include={
"user": {
"id",
"username",
}
}
)
Exclude
transform = Transform(
exclude={
"password": True,
"token": True,
}
)
Redact
transform = Transform(
redact={
"email": True,
"credit_card": True,
}
)
TransformSink
from lumax.sinks.transform import TransformSink
sink = TransformSink(
sink=ConsoleSink(),
transform=transform,
)
Structured Fields
Additional fields can be attached to every log event.
logger.info(
"Payment processed",
payment_id="pay_123",
amount=1000,
currency="USD",
)
These fields remain structured and serializable.
JSON Serialization
Events are serializable via:
event.to_json()
lumax includes a robust serializer capable of handling:
- dataclasses
- datetime
- UUID
- enums
- mappings
- sequences
- Pydantic models
Integration with Observability Stacks
lumax is designed to integrate cleanly with:
- Grafana Loki
- Promtail
- ELK Stack
- OpenTelemetry pipelines
- Cloud logging systems
Because events are structured JSON objects, lumax works naturally with log aggregation systems.
Design Philosophy
lumax follows several core principles:
Immutable Events
Events are never mutated after creation.
Structured First
Logs should be machine-readable by default.
Composable Pipelines
Behavior is composed through sinks.
Minimal Core
The framework stays lightweight while remaining extensible.
Explicit Transformations
Filtering and field shaping are separate concerns.
Example Pipeline
from lumax.core.filter import Filter
from lumax.core.identity import Identity
from lumax.core.level import Level
from lumax.core.transform import Transform
from lumax.logger import Logger
from lumax.sinks.console import ConsoleSink
from lumax.sinks.filtering import FilterSink
from lumax.sinks.transform import TransformSink
sink = TransformSink(
sink=FilterSink(
sink=ConsoleSink(),
filter=Filter(
level=Level.INFO,
),
),
transform=Transform(
redact={
"password": True,
"token": True,
},
),
)
logger = Logger(
identity=Identity(
environment="development",
service="api",
type="application",
),
sinks=[sink],
)
logger.info(
"User login",
username="agra",
password="secret",
token="jwt-token",
)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lumax-0.1.1.tar.gz.
File metadata
- Download URL: lumax-0.1.1.tar.gz
- Upload date:
- Size: 35.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dc6bea2f9c788571b73aafea53c5c7a7a7e23a6aa161d86f7d8e9710bfd7d62
|
|
| MD5 |
46d0356d05b4aab0711c344e226043f4
|
|
| BLAKE2b-256 |
ba782f4bf620fc29c4f288612f6344d77b7d482a1a1fb37695f2563ec1bca493
|
Provenance
The following attestation bundles were made for lumax-0.1.1.tar.gz:
Publisher:
python-publish.yml on agrahub/lumax-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lumax-0.1.1.tar.gz -
Subject digest:
5dc6bea2f9c788571b73aafea53c5c7a7a7e23a6aa161d86f7d8e9710bfd7d62 - Sigstore transparency entry: 1601960554
- Sigstore integration time:
-
Permalink:
agrahub/lumax-py@27669951625d7b7cee5425b6aa6a893f22b9a629 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/agrahub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@27669951625d7b7cee5425b6aa6a893f22b9a629 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lumax-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lumax-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dc70e2cbc84f00d9a98fa21c827e0fddc6d78cc5dcc3e38d5abecb8153dcbc8
|
|
| MD5 |
b504da35ae8b90ca2cf74dccdd06629d
|
|
| BLAKE2b-256 |
22fc1d058134a2fc8bf9522e8e4bd8fb5d5ab83578ebda9191bed88e67035b8f
|
Provenance
The following attestation bundles were made for lumax-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on agrahub/lumax-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lumax-0.1.1-py3-none-any.whl -
Subject digest:
3dc70e2cbc84f00d9a98fa21c827e0fddc6d78cc5dcc3e38d5abecb8153dcbc8 - Sigstore transparency entry: 1601960565
- Sigstore integration time:
-
Permalink:
agrahub/lumax-py@27669951625d7b7cee5425b6aa6a893f22b9a629 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/agrahub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@27669951625d7b7cee5425b6aa6a893f22b9a629 -
Trigger Event:
release
-
Statement type: