Skip to main content

init_from_env

Function init_from_env 

Source
pub fn init_from_env() -> Result<(), String>
Expand description

Install a subscriber configured entirely from the environment.

Nothing is enabled by default — a binary that sets neither variable logs exactly as much as one with no subscriber at all. RUST_LOG is a full Targets spec (gc=debug,cranelift_codegen=info); CLJRS_X_FLAG names feature targets (apply_x_flag) and is layered on top, so both can be used together.

This is what a generated AOT harness calls, so CLJRS_X_FLAG=debug:gc ./my-binary behaves the same as cljrs -X debug:gc run my-app.cljrs — including on a value that does not parse. CLJRS_X_FLAG is ours alone and has exactly one meaning, so a bad one is an Err here just as a bad -X is a hard error in the CLI: the caller reports it and exits, because leaving someone who asked for diagnostics with none is the one outcome nobody wants. (RUST_LOG is treated more leniently — see apply_rust_log.)