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
tracingvocabulary so consumers canuse 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
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Attach a span to astd::future::Future. - span
- Re-exports of the common
tracingvocabulary so consumers canuse 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
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs an event at the debug level. - enabled
- Re-exports of the common
tracingvocabulary so consumers canuse 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
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs an event at the error level. - event
- Re-exports of the common
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs a newEvent. - info
- Re-exports of the common
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs an event at the info level. - span
- Re-exports of the common
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs a new span. - trace
- Re-exports of the common
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs an event at the trace level. - warn
- Re-exports of the common
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Constructs an event at the warn level.
Structs§
- Enriched
Root Span Builder - A
RootSpanBuilderthat adds acorrelation_idfield to the root span when one ofDEFAULT_HEADER_CHAINis present on the request. - Init
Options - Configuration for
init_with. - Level
- Re-exports of the common
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Describes the level of verbosity of a span or event. - Span
- Re-exports of the common
tracingvocabulary so consumers canuse 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
TracingLoggermiddleware backed byEnrichedRootSpanBuilder(the default root span enriched with acorrelation_idfield). - get_
actix_ web_ logger_ with - Construct a
TracingLoggermiddleware backed by the suppliedRootSpanBuilder. 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
tracingvocabulary so consumers canuse kamu_logging::{info, instrument, ...}without a separate import. Instruments a function to create and enter atracingspan every time the function is called.