rfd-logging

The Problem

Every Python service I build needs logging. Every time I set it up from scratch, I make the same decisions: structured JSON output, file rotation, stdout capture for NSSM, a request ID field for tracing requests across service calls. I’ve written that setup five times across five different services.

The sixth time, I packaged it instead.

What It Does

rfd-logging is a zero-dependency Python logging wrapper that gives you structured, production-ready logging in one import.

from rfd_logging import get_logger

logger = get_logger("my-service")
logger.info("Server started", extra={"port": 8030})

Every log line is structured JSON:

{
  "timestamp": "2026-06-21T14:32:01.447Z",
  "level": "INFO",
  "service": "my-service",
  "message": "Server started",
  "request_id": "a3f9b2c1",
  "port": 8030
}

Fields on every line:

  • timestamp � ISO 8601, UTC
  • level � INFO / WARNING / ERROR / CRITICAL
  • service � set at logger creation, not per-call
  • message � the log message
  • request_id � mandatory context field for cross-service tracing
  • extra � any additional key-value pairs passed at log time
  • error and traceback � conditional, only present on exceptions

Why Structured JSON

Because grep isn’t enough at scale. When a service throws an error in production, you need to filter by request_id across five different log files, correlate timestamps, and find the exact call chain. Structured JSON makes that possible with any log aggregator � CloudWatch, Datadog, or a local jq pipe. Unstructured logs make it archaeology.

The Operational Details

File output: logs/service.log with 10MB rotation and 5 backup files. Sized for NSSM-managed Windows services where log directories are predictable.

Stdout capture: Logs also emit to stdout, which NSSM captures automatically. No separate configuration needed for service log capture.

Log level: Controlled by RFD_LOG_LEVEL environment variable. Defaults to INFO. Change it without touching code.

Zero dependencies: Pure stdlib. No structlog, no python-json-logger, nothing to pin or audit. It installs fast and stays out of the way.

Install

pip install rfd-logging

Or with uv:

uv add rfd-logging

Floor: 16 tests, 0 failures.

Why This Is on the Portfolio

Two years of building production Python services taught me what I actually needed from a logger. This is the distillation of that. It’s small, specific, and solves exactly one problem well.

The code is on GitHub. The package is on PyPI. It’s MIT licensed.

If you’re building Python services with NSSM on Windows � or any service where structured logging and NSSM stdout capture matter � this is the setup I use on every project.


PyPI: rfd-logging GitHub: RFD_Logging


Pure Python stdlib. Zero dependencies. 16 tests. MIT license.