From 101e0e6171ad44cd64cb863924f0f12666bc919a Mon Sep 17 00:00:00 2001 From: Ziy1-Tan Date: Thu, 12 Sep 2024 22:54:33 +0800 Subject: [PATCH] fix style Signed-off-by: Ziy1-Tan --- vmm/task/src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vmm/task/src/main.rs b/vmm/task/src/main.rs index ce71cb24..3ac4c105 100644 --- a/vmm/task/src/main.rs +++ b/vmm/task/src/main.rs @@ -18,6 +18,7 @@ limitations under the License. use std::{collections::HashMap, convert::TryFrom, path::Path, process::exit, sync::Arc}; +use anyhow::anyhow; use containerd_shim::{ asynchronous::{monitor::monitor_notify_by_pid, util::asyncify}, error::Error, @@ -187,8 +188,12 @@ fn init_logger(log_level: &str, enable_tracing: bool) -> anyhow::Result<()> { } let subscriber = Registry::default().with(env_filter).with(layers); - tracing::subscriber::set_global_default(subscriber).expect("unable to set global subscriber"); - + match tracing::subscriber::set_global_default(subscriber) { + Ok(_) => {} + Err(e) => { + return Err(anyhow!("failed to set global default subscriber: {}", e)); + } + } Ok(()) }