Skip to main content

Crate cljrs_logging

Crate cljrs_logging 

Source
Expand description

Feature-gated logging for clojurust.

Provides per-feature debug and trace logging controlled at runtime via CLI flags. Features are arbitrary strings (e.g. “gc”, “jit”, “reader”) — any feature name is accepted even if no code ever logs with it.

§Usage

// Set features from CLI flags
cljrs_logging::set_feature_level("gc", Level::Debug);
cljrs_logging::set_feature_level("jit", Level::Trace);

// In code:
feat_debug!("gc", "starting collection, heap_size={}", heap_size);
feat_trace!("gc", "visiting object at {:p}", ptr);

Macros§

feat_debug
Log a message at debug level for a feature. Only prints if the feature is enabled at debug level or higher.
feat_trace
Log a message at trace level for a feature.

Enums§

Level
Log level for a feature.

Functions§

feature_level
Get the logging level for a feature. Returns Level::Off if the feature has not been configured.
is_enabled
Returns true if the given feature is enabled at least at level.
parse_x_flag
Parse a -X flag value like "debug:gc,jit" or "trace:reader" and register the appropriate feature levels.
set_feature_level
Set the logging level for a single feature.