MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / set_log_level

Function set_log_level

crates/chat-cli/src/logging.rs:207–224  ·  view source on GitHub ↗

Set the log level to the given level. # Returns On success, returns the old log level.

(level: String)

Source from the content-addressed store, hash-verified

205///
206/// On success, returns the old log level.
207pub fn set_log_level(level: String) -> Result<String, Error> {
208 info!("Setting log level to {level:?}");
209
210 let old_level = get_log_level();
211 *Q_LOG_LEVEL_GLOBAL.lock().unwrap() = Some(level);
212
213 let filter_layer = create_filter_layer();
214 *MAX_LEVEL.lock().unwrap() = filter_layer.max_level_hint();
215
216 ENV_FILTER_RELOADABLE_HANDLE
217 .lock()
218 .unwrap()
219 .as_ref()
220 .expect("set_log_level must not be called before logging is initialized")
221 .reload(filter_layer)?;
222
223 Ok(old_level)
224}
225
226/// Get the current max log level
227///

Callers 2

initialize_loggingFunction · 0.85
test_loggingFunction · 0.85

Calls 3

create_filter_layerFunction · 0.85
get_log_levelFunction · 0.70
as_refMethod · 0.45

Tested by 1

test_loggingFunction · 0.68