Skip to main content

cliffracer-logging

NATS log streaming, correlation-filtered sinks, structured logging setup and per-dispatch timing logs for cliffracer services.

Core uses loguru for its own log lines. This package is what configures logging: sinks, formats and files.

from cliffracer import CliffracerService, ServiceConfig, rpc
from cliffracer_logging import LoggingExtension

class Orders(CliffracerService):
    logging = LoggingExtension(to_nats=True)

    @rpc
    async def place(self, item: str) -> dict[str, str]:
        return {"ok": item}

LoggingExtension(to_nats=False, timing=True)

to_nats stream this service's logs to logs.<service>.<level>
timing log "<kind> <subject> <ms>ms" at DEBUG for every dispatch

health_details() reports {"to_nats": bool, "streaming": bool}. streaming is whether a sink is attached, so a service configured for NATS while its connection is down reports to_nats: true, streaming: false.

stop() removes the sink it added, using the handler id loguru returned when it was attached. A service that stops and starts again therefore has one sink.

What timing covers

timing measures whatever runs through the hook chain. Four kinds reach it today, and each appears as the first word of the log line: rpc, async_rpc, event and timer.

The container runs the chain for every dispatch, so new dispatch paths are timed automatically. This is verified by tests/unit/test_instrumentation_coverage.py.

Outbound calls are logged by core itself: call_rpc, call_async and broadcast_message each write their own line. connect and disconnect are visible through the container's NATS callbacks.

LoggingConfig.configure(service_name, ...)

Structured JSON or human-readable logging to console and rotating files. It is a @staticmethod, so call it on the class.

service_name is the first positional argument and is required. The level keyword is log_level, and it defaults to "INFO".

Correlation-filtered logging

setup_correlation_logging, get_correlation_logger and CorrelationLoggerMixin attach the current correlation id to every record.

Installed from PyPI, versioned in lockstep with cliffracer.

Metadata

Release files for cliffracer-logging 1.0.0

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

Source distribution (sdist)

Source distribution for cliffracer-logging 1.0.0
File Size Uploaded Provenance
cliffracer_logging-1.0.0.tar.gz 12.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cliffracer-logging 1.0.0
File Interpreter ABI Platform
cliffracer_logging-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 kB

Release files / cliffracer_logging-1.0.0.tar.gz

Download URL cliffracer_logging-1.0.0.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
88be7160a85dfabbaf47f1916d396edc509496a3d711c6b5dfe286209af09214
BLAKE2b-256 checksum
How to use checksums
fc3e1286ad1bf76376a41b747d8abe9a3ac5d84d8f00cb0417c007787265a9d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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":true}

Release files / cliffracer_logging-1.0.0-py3-none-any.whl

Download URL cliffracer_logging-1.0.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fa2b6b7a9a86d5edb5aca5f8882f0b1a09900e32eb5bb55b30cac5a1e6a039d
BLAKE2b-256 checksum
How to use checksums
50d203167173793234d22586ff38728395bd3426cee42fd80938b21c3fae617d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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":true}

Security for cliffracer-logging 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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