rfd-logging
Standardised JSON logging for RFD services. One line per entry, machine-parseable, zero dependencies.
Installation
From PyPI:
pip install rfd-logging
Editable local install (for RFD services):
uv add --editable C:\Github\RFD_Logging
Usage
from rfd_logging import get_logger
logger = get_logger("rfd-collectors", log_dir="logs")
# Basic info
logger.info("Service started")
# With extra fields
logger.info("Request received", extra={"endpoint": "/api/data", "request_id": "req-abc123"})
# Error with description
logger.error("Database unreachable", extra={"error": "Connection refused", "host": "db.local"})
# Exception with traceback
try:
1 / 0
except ZeroDivisionError:
logger.exception("Unhandled error during processing")
Sample JSON output
{"timestamp": "2026-06-21T20:38:33.092Z", "level": "INFO", "service": "rfd-collectors", "message": "Request received", "extra": {"endpoint": "/api/data"}, "request_id": "req-abc123"}
{"timestamp": "2026-06-21T20:38:33.105Z", "level": "ERROR", "service": "rfd-collectors", "message": "Database unreachable", "extra": {"host": "db.local"}, "request_id": null, "error": "Connection refused"}
{"timestamp": "2026-06-21T20:38:33.110Z", "level": "ERROR", "service": "rfd-collectors", "message": "Unhandled error during processing", "extra": {}, "request_id": null, "traceback": "Traceback (most recent call last):\n ..."}
Output fields
| Field | Always present | Description |
|---|---|---|
timestamp |
✓ | ISO 8601 UTC with milliseconds — 2026-06-21T20:38:33.092Z |
level |
✓ | DEBUG | INFO | WARNING | ERROR | CRITICAL |
service |
✓ | Service name passed to get_logger |
message |
✓ | Rendered log message |
extra |
✓ | Dict of caller-supplied extra fields (empty dict if none) |
request_id |
✓ | Gateway trace ID — null if not set |
error |
Conditional | String error description when extra={"error": ...} is passed |
traceback |
Conditional | Exception traceback when exc_info is set (e.g. via logger.exception) |
Configuration
Log level
Set via environment variable before starting the service:
set RFD_LOG_LEVEL=DEBUG # Windows
export RFD_LOG_LEVEL=DEBUG # Linux/macOS
Default: INFO. Valid values: DEBUG, INFO, WARNING, ERROR, CRITICAL.
The variable is read at the time get_logger is first called for a given service — not at import time.
Log file location and rotation
get_logger(service, log_dir) writes to {log_dir}/service.log.
- Default
log_dir:./logsrelative to the working directory - Rotation: 10 MB per file, 5 backups kept (
service.log,service.log.1…service.log.5) - Encoding: UTF-8
- Also emits to stdout for NSSM
AppStdoutcapture
The log_dir is created automatically (including parents) if it does not exist.
Idempotent logger creation
get_logger is safe to call multiple times with the same service name — subsequent calls return the cached logger without adding duplicate handlers:
logger_a = get_logger("my-service", log_dir="logs")
logger_b = get_logger("my-service", log_dir="logs")
assert logger_a is logger_b # True
Zero dependencies
rfd-logging uses only the Python standard library: logging, json, datetime, pathlib, os. No third-party packages are installed.
Requirements
- Python ≥ 3.11
Metadata
Release files for rfd-logging 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rfd_logging-0.1.3.tar.gz | 11.2 kB | Without provenance | Details for rfd_logging-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rfd_logging-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for rfd_logging-0.1.3-py3-none-any.whl |
Total release size: 21.1 kB
Release files / rfd_logging-0.1.3.tar.gz
| Download URL | rfd_logging-0.1.3.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
176084a2cd6f927da459cf744bc3848fa331c0c81bbefb97eebaa039b3918465
|
|
BLAKE2b-256 checksum How to use checksums |
c73f6728b0a4e5d672fdb6309d67e8a7f3d984a803863792860e9cde929c3b75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / rfd_logging-0.1.3-py3-none-any.whl
| Download URL | rfd_logging-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2fcfd9b6057287cf18f00f881f2926a62425a140f8f3844737b4720123b2c7e
|
|
BLAKE2b-256 checksum How to use checksums |
0e09ce69278215c63e85fddd20b8a7a27609a1df3f1ef2829795da969fd833ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for rfd-logging 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.