Skip to main content

Module logging

Module logging 

Source
Expand description

Diagnostic logging configuration (native only; see the module docs). Diagnostic logging configuration: tracing targets and filters.

The runtime, the GC, and the compiler emit their internal diagnostics with plain tracing::debug! / tracing::trace! under a small set of feature targets — see [FEATURE_TARGETS]. Selecting them is a filter, not an API: anything that can build a [Targets] filter can turn them on.

Two entry points build that filter for the two hosts that ship in this workspace:

  • The cljrs CLI starts from [base_filter] (its --debug/--trace level, with the feature targets pinned off and the codegen crates pinned to warn), layers each -X debug:gc,jit flag on with [apply_x_flag], and installs the result with [init].
  • A generated AOT harness calls [init_from_env], which enables nothing unless CLJRS_X_FLAG or RUST_LOG asks for it.

An embedding host is free to ignore all of this and install its own subscriber; the emitting code has no opinion.

This module is native-only: tracing-subscriber is a host-side concern and a wasm32 runtime installs no subscriber. The tracing::debug! call sites themselves compile everywhere and are inert without one.

Constants§

FEATURE_TARGETS
Targets carrying the runtime’s own internal diagnostics.
NOISY_TARGETS
Crates whose logging is noisy enough to drown out everything else.

Functions§

apply_rust_log
Replace base with RUST_LOG’s filter when that variable is set and non-empty.
apply_x_flag
Fold one -X / CLJRS_X_FLAG spec into filter.
base_filter
The filter a host starts from: everything at default, the codegen crates pinned to warn, and the runtime’s FEATURE_TARGETS pinned off.
init
Install filter as the process’s global subscriber, formatting to stderr.
init_from_env
Install a subscriber configured entirely from the environment.