mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
agent: Log ttrpc messages
The `ttrpc` crate uses the `log` crate for logging. But the agent uses the `slog` crate. This means that currently, all `ttrpc` log messages are being discarded. Use the `slog-stdlog` create to redirect `log` crate logging calls into `slog` so they are visible in the agents log output. Fixes: #978. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
286eebf087
commit
21cd7ad172
12
src/agent/Cargo.lock
generated
12
src/agent/Cargo.lock
generated
@ -392,6 +392,7 @@ dependencies = [
|
|||||||
"signal-hook",
|
"signal-hook",
|
||||||
"slog",
|
"slog",
|
||||||
"slog-scope",
|
"slog-scope",
|
||||||
|
"slog-stdlog",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"ttrpc",
|
"ttrpc",
|
||||||
]
|
]
|
||||||
@ -1077,6 +1078,17 @@ dependencies = [
|
|||||||
"slog",
|
"slog",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slog-stdlog"
|
||||||
|
version = "4.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8228ab7302adbf4fcb37e66f3cda78003feb521e7fd9e3847ec117a7784d0f5a"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"slog",
|
||||||
|
"slog-scope",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.4.2"
|
version = "1.4.2"
|
||||||
|
@ -27,6 +27,10 @@ regex = "1"
|
|||||||
# (by stopping the compiler from removing log calls).
|
# (by stopping the compiler from removing log calls).
|
||||||
slog = { version = "2.5.2", features = ["dynamic-keys", "max_level_trace", "release_max_level_info"] }
|
slog = { version = "2.5.2", features = ["dynamic-keys", "max_level_trace", "release_max_level_info"] }
|
||||||
slog-scope = "4.1.2"
|
slog-scope = "4.1.2"
|
||||||
|
|
||||||
|
# Redirect ttrpc log calls
|
||||||
|
slog-stdlog = "4.0.0"
|
||||||
|
|
||||||
# for testing
|
# for testing
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
prometheus = { version = "0.9.0", features = ["process"] }
|
prometheus = { version = "0.9.0", features = ["process"] }
|
||||||
|
@ -198,6 +198,9 @@ 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 _log_guard = slog_stdlog::init()?;
|
||||||
|
|
||||||
start_sandbox(&logger, &config, init_mode)?;
|
start_sandbox(&logger, &config, init_mode)?;
|
||||||
|
|
||||||
let _ = log_handle.join();
|
let _ = log_handle.join();
|
||||||
|
Loading…
Reference in New Issue
Block a user