mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 22:53:43 +00:00
agent: Only show ttrpc logs for trace log level
Only display the `ttrpc` crate log output when full logging (trace level) is enabled. This is a slight abuse of log levels but provides developers and testers what they need whilst also keeping the logs relatively quiet for the default info log level (the `ttrpc` crate logging is a bit "chatty"). Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
21cd7ad172
commit
8907a33907
1
src/agent/Cargo.lock
generated
1
src/agent/Cargo.lock
generated
@ -375,6 +375,7 @@ dependencies = [
|
|||||||
"cgroups",
|
"cgroups",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
|
"log",
|
||||||
"logging",
|
"logging",
|
||||||
"netlink",
|
"netlink",
|
||||||
"nix 0.17.0",
|
"nix 0.17.0",
|
||||||
|
@ -30,6 +30,7 @@ slog-scope = "4.1.2"
|
|||||||
|
|
||||||
# Redirect ttrpc log calls
|
# Redirect ttrpc log calls
|
||||||
slog-stdlog = "4.0.0"
|
slog-stdlog = "4.0.0"
|
||||||
|
log = "0.4.11"
|
||||||
|
|
||||||
# for testing
|
# for testing
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
@ -198,8 +198,12 @@ fn main() -> Result<()> {
|
|||||||
// which is required to satisfy the the lifetime constraints of the auto-generated gRPC code.
|
// which is required to satisfy the the lifetime constraints of the auto-generated gRPC code.
|
||||||
let _guard = slog_scope::set_global_logger(logger.new(o!("subsystem" => "rpc")));
|
let _guard = slog_scope::set_global_logger(logger.new(o!("subsystem" => "rpc")));
|
||||||
|
|
||||||
// Redirect ttrpc log calls to slog
|
let mut _log_guard: Result<(), log::SetLoggerError> = Ok(());
|
||||||
let _log_guard = slog_stdlog::init()?;
|
|
||||||
|
if config.log_level == slog::Level::Trace {
|
||||||
|
// Redirect ttrpc log calls to slog iff full debug requested
|
||||||
|
_log_guard = Ok(slog_stdlog::init().map_err(|e| e)?);
|
||||||
|
}
|
||||||
|
|
||||||
start_sandbox(&logger, &config, init_mode)?;
|
start_sandbox(&logger, &config, init_mode)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user