From b2cc45e0a3e5cea36d35af5b843abe4155d5bbe5 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 4 Aug 2021 19:35:56 +0000 Subject: [PATCH] vhost_user_*: set up logging These crates are written to produce log messages using the error! macro, but their logs didn't actually go anywhere, which made it very difficult to debug when they're not working. I've used env_logger here because it's the same log implementation that the hypervisor crate uses. Signed-off-by: Alyssa Ross --- Cargo.lock | 2 ++ vhost_user_block/Cargo.toml | 1 + vhost_user_block/src/main.rs | 2 ++ vhost_user_net/Cargo.toml | 1 + vhost_user_net/src/main.rs | 2 ++ 5 files changed, 8 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 64feaad67..ca1ad0f64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1150,6 +1150,7 @@ version = "0.1.0" dependencies = [ "block_util", "clap", + "env_logger", "epoll", "libc", "log", @@ -1167,6 +1168,7 @@ name = "vhost_user_net" version = "0.1.0" dependencies = [ "clap", + "env_logger", "epoll", "libc", "log", diff --git a/vhost_user_block/Cargo.toml b/vhost_user_block/Cargo.toml index e3edf0364..61076bd27 100644 --- a/vhost_user_block/Cargo.toml +++ b/vhost_user_block/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" [dependencies] block_util = { path = "../block_util" } clap = { version = "2.33.3", features=["wrap_help"] } +env_logger = "0.9.0" epoll = ">=4.0.1" libc = "0.2.98" log = "0.4.14" diff --git a/vhost_user_block/src/main.rs b/vhost_user_block/src/main.rs index 79ad1aeac..a9ca1f8a0 100644 --- a/vhost_user_block/src/main.rs +++ b/vhost_user_block/src/main.rs @@ -16,6 +16,8 @@ use clap::{App, Arg}; use vhost_user_block::start_block_backend; fn main() { + env_logger::init(); + let cmd_arguments = App::new("vhost-user-blk backend") .version(crate_version!()) .author(crate_authors!()) diff --git a/vhost_user_net/Cargo.toml b/vhost_user_net/Cargo.toml index dc0b82223..b7969fc73 100644 --- a/vhost_user_net/Cargo.toml +++ b/vhost_user_net/Cargo.toml @@ -6,6 +6,7 @@ edition = "2018" [dependencies] clap = { version = "2.33.3", features=["wrap_help"] } +env_logger = "0.9.0" epoll = ">=4.0.1" libc = "0.2.98" log = "0.4.14" diff --git a/vhost_user_net/src/main.rs b/vhost_user_net/src/main.rs index 91c027539..d5e0ed154 100644 --- a/vhost_user_net/src/main.rs +++ b/vhost_user_net/src/main.rs @@ -13,6 +13,8 @@ use clap::{App, Arg}; use vhost_user_net::start_net_backend; fn main() { + env_logger::init(); + let cmd_arguments = App::new("vhost-user-net backend") .version(crate_version!()) .author(crate_authors!())