Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lumax-0.1.0.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lumax-0.1.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file lumax-0.1.0.tar.gz.

File metadata

  • Download URL: lumax-0.1.0.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

Hashes for lumax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae5a894f7ab161eef4e574ece1a7b05b077cde7996e9ba9c838fef4006db12e8
MD5 9373dfac6b848414b01f67ef0af86ada
BLAKE2b-256 d605bcd7f0d74e60449c0ebbd7498488c1fa042c5e3a2c430b26ac33d9c1e5a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for lumax-0.1.0.tar.gz:

Publisher: python-publish.yml on agrahub/lumax-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lumax-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lumax-0.1.0-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

Hashes for lumax-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abb5f167be2b328ac21d70d8c6049012bf0a8a242656920926f924752a638bad
MD5 86d4a9fe2d399b174cd8d3450f1c6d1c
BLAKE2b-256 5f3369fb3f8f100cda0dededa7d28e07f9d3c29817f755e449aef960c6db31ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for lumax-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on agrahub/lumax-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page