Skip to main content

FastLOG

FastLOG is a lightweight wrapper around Loguru with sensible defaults, automatic trace_id, stdlib logging interception, and a directory watcher that can forward log bursts to HTTP, Telegram, or OTLP.

Features

  • Zero-config logging: from fastlog import log; log.info("hello")
  • Automatic trace_id injection for application logs
  • Simple file logging with rotation and retention via configure()
  • Standard logging records are routed through FastLOG
  • fastlog CLI tails *.log files and forwards high-severity events

Installation

uv add fastlog-io
uv add "fastlog-io[otlp]"

Or with pip:

pip install fastlog-io
pip install "fastlog-io[otlp]"

Requirements:

Quickstart

from fastlog import configure, log

configure(
    level="INFO",
    log_path="./logs/app.log",
    rotation="10 MB",
    retention="7 days",
)

log.info("service started")

with log.trace_ctx():
    log.bind(action="api.call").info("request done")

# or use
import logging
logger = logging.getLogger("my-app")
logger.warning("cache miss")

Example output:

2025-10-13 12:23:00.193 | INFO     | 3hAhb3OFpU7zXKWBwp | ts.<module>:13 | service started
2025-10-13 12:23:00.194 | WARNING  | 1F1FwLwm4Orok0gs0a | [my-app]ts.<module>:16 | cache miss
2025-10-13 12:23:00.194 | INFO     | WG8yiDxzO3MCmWy8CB | api.call     | request done

Watcher CLI

The fastlog CLI watches a directory of *.log files, resumes from stored byte offsets, batches matching lines, and sends them to one or more destinations.

uv tool install fastlog-io

# HTTP
uv run fastlog ./logs --endpoint "$FASTLOG_NOTIFY_ENDPOINT"

# Telegram
uv run fastlog ./logs \
  --tg-token "$FASTLOG_NOTIFY_TG_TOKEN" \
  --tg-chat-id "$FASTLOG_NOTIFY_TG_CHAT_ID"

# OTLP
uv run fastlog ./logs --otlp-endpoint "http://127.0.0.1:4318/v1/logs"

Key points:

  • --min-level defaults to WARNING
  • offsets are stored in .multilogwatch.state.json
  • HTTP and Telegram retries default to 3
  • flush() drains queued batches; close() drains and stops workers
  • OTLP uses the native OpenTelemetry exporter configuration model when possible

Run uv run fastlog --help for the full option list.

OTLP Notes

Install fastlog-io[otlp] to enable OTLP export.

  • --otlp-endpoint explicitly overrides the collector endpoint
  • when --otlp-endpoint is unset, FastLOG falls back to OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, then OTEL_EXPORTER_OTLP_ENDPOINT
  • --otlp-protocol, OTEL_EXPORTER_OTLP_LOGS_PROTOCOL, or OTEL_EXPORTER_OTLP_PROTOCOL selects http, grpc, or http/protobuf
  • headers, timeout, TLS, and resource attributes are delegated to the native OpenTelemetry SDK/exporter env handling

Common OTLP env vars:

Variable Description
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT Logs-specific OTLP endpoint
OTEL_EXPORTER_OTLP_ENDPOINT Generic OTLP endpoint fallback
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL http, grpc, or http/protobuf
OTEL_EXPORTER_OTLP_PROTOCOL Generic protocol fallback
OTEL_EXPORTER_OTLP_LOGS_HEADERS Logs-specific request headers
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT Logs-specific exporter timeout
OTEL_SERVICE_NAME Fallback source for resource service.namespace
OTEL_RESOURCE_ATTRIBUTES Extra resource attributes
RUN_ENV / ENV Resource deployment.environment when set
VERSION Resource service.version when set

Common Environment Variables

Variable Default Description
LOG_PATH empty File output path
LOG_LEVEL INFO Default log level
LOG_ROTATION 100 MB Loguru rotation policy
FASTLOG_NOTIFY_ENDPOINT empty HTTP destination for watcher notifications
FASTLOG_NOTIFY_LEVEL WARNING Default watcher threshold
FASTLOG_NOTIFY_TIMEOUT empty HTTP timeout override in seconds
FASTLOG_HTTP_ATTEMPTS empty HTTP and Telegram retry count, default 3
FASTLOG_WINDOW_SECONDS 30 Batch window in seconds
FASTLOG_NOTIFY_MAX_BYTES 4096 Max payload size per request
FASTLOG_NOTIFY_TG_TOKEN empty Telegram bot token
FASTLOG_NOTIFY_TG_CHAT_ID empty Telegram chat id
FASTLOG_OTLP_MAX_BATCH 256 Max records per OTLP export

Development

uv run --with '.[test]' pytest -q
uv build
uv run --with dist/*.whl --with pytest pytest -q

License

MIT © 2025 OWQ

Metadata

Release files for fastlog-io 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastlog-io 0.3.6
File Size Uploaded
fastlog_io-0.3.6.tar.gz 61.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastlog-io 0.3.6
File Interpreter ABI Platform
fastlog_io-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 88.1 kB

Release files / fastlog_io-0.3.6.tar.gz

Download URL fastlog_io-0.3.6.tar.gz
Size 61.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b2a53f8b10ad9caf23afbe692703ac6ce55ce56448b11e47bdf188e7d22aa257
BLAKE2b-256 checksum
How to use checksums
ce19b9bde50838462965af2a0e1b76f416a20a679cf2fe16b3de518f0fb31a4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / fastlog_io-0.3.6-py3-none-any.whl

Download URL fastlog_io-0.3.6-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6be35f1728bbd43858fe4ae4f569da2adbd03c54bcd10287efdc56f6da7fccc3
BLAKE2b-256 checksum
How to use checksums
30c688f4fe0372b2ff9f035a7479e2ec18adcb11a2e827f7fc48be670c5efc00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.2.4

2 release files

0.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page