Skip to main content

Crate kamu_logging

Crate kamu_logging 

Source
Expand description

kamu-logging — opinionated tracing setup for PT IMMER services.

Call init from main for the zero-config path, or init_with with an InitOptions builder for explicit format / sink / filter / OTLP configuration. See the crate README for worked examples. On wasm32-unknown-unknown, enable only the wasm32 feature to install a panic hook and emit tracing events to the JavaScript console. This path is suitable for Cloudflare Workers via workers-rs; systemd, Actix Web, and OTLP exporter features are native-only.

Re-exports common tracing items so consumers can avoid a separate tracing import for the basic logging vocabulary.

Modules§

correlation
Correlation-id helpers for distributed tracing.
event
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Events represent single points in time during the execution of a program.
instrument
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Attach a span to a std::future::Future.
span
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Spans represent periods of time in which a program was executing in a particular context.

Macros§

debug
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs an event at the debug level.
enabled
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Checks whether a span or event is enabled based on the provided metadata.
error
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs an event at the error level.
event
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs a new Event.
info
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs an event at the info level.
span
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs a new span.
trace
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs an event at the trace level.
warn
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Constructs an event at the warn level.

Structs§

EnrichedRootSpanBuilder
A RootSpanBuilder that adds a correlation_id field to the root span when one of DEFAULT_HEADER_CHAIN is present on the request.
InitOptions
Configuration for init_with.
Level
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Describes the level of verbosity of a span or event.
Span
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. A handle representing a span, with the capability to enter the span if it exists.

Enums§

Error
Errors returned by init / init_with.
Format
Output format for the fmt layer.
Sink
Where to write log events.

Functions§

get_actix_web_logger
Construct a TracingLogger middleware backed by EnrichedRootSpanBuilder (the default root span enriched with a correlation_id field).
get_actix_web_logger_with
Construct a TracingLogger middleware backed by the supplied RootSpanBuilder. Use this when the enriched default does not fit (e.g., to add tenant_id, user_id, or a service-specific field).
init
Initialize the global tracing subscriber with default options.
init_or_skip
Initialize the global tracing subscriber, returning Ok(()) if a subscriber is already set.
init_with
Initialize the global tracing subscriber from explicit options.

Attribute Macros§

instrument
Re-exports of the common tracing vocabulary so consumers can use kamu_logging::{info, instrument, ...} without a separate import. Instruments a function to create and enter a tracing span every time the function is called.