MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / terminal_directives

Function terminal_directives

atomic-cli/src/logging/mod.rs:193–203  ·  view source on GitHub ↗

The terminal's filter: `RUST_LOG` wins, then `--verbose`, then warnings. Every command advertises `-v, --verbose`, and the debug lines that explain which identity a request authenticated as are only reachable through it. Like `env_logger`, a `RUST_LOG` with no usable directive shows errors rather than nothing.

(rust_log: Option<String>, verbose: bool)

Source from the content-addressed store, hash-verified

191/// Like `env_logger`, a `RUST_LOG` with no usable directive shows errors
192/// rather than nothing.
193fn terminal_directives(rust_log: Option<String>, verbose: bool) -> String {
194 let directives = match rust_log.filter(|value| !value.trim().is_empty()) {
195 Some(value) if parses(&value) => value,
196 Some(_) => "error".to_string(),
197 None if verbose => {
198 format!("{VERBOSE_FILTER},{FILE_ONLY_TARGETS},{TRACING_NATIVE_DEPENDENCIES}")
199 }
200 None => format!("{TERMINAL_FILTER},{TRACING_NATIVE_DEPENDENCIES}"),
201 };
202 format!("{directives},{PANIC_TARGET}=off,{PRINTED_TARGET}=off")
203}
204
205fn parses(directives: &str) -> bool {
206 directives

Callers 1

terminal_layerFunction · 0.85

Calls 2

parsesFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected