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 <hi@alyssa.is>
This commit is contained in:
Alyssa Ross 2021-08-04 19:35:56 +00:00 committed by Sebastien Boeuf
parent deb4ad5e23
commit b2cc45e0a3
5 changed files with 8 additions and 0 deletions

2
Cargo.lock generated
View File

@ -1150,6 +1150,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"block_util", "block_util",
"clap", "clap",
"env_logger",
"epoll", "epoll",
"libc", "libc",
"log", "log",
@ -1167,6 +1168,7 @@ name = "vhost_user_net"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"env_logger",
"epoll", "epoll",
"libc", "libc",
"log", "log",

View File

@ -7,6 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
block_util = { path = "../block_util" } block_util = { path = "../block_util" }
clap = { version = "2.33.3", features=["wrap_help"] } clap = { version = "2.33.3", features=["wrap_help"] }
env_logger = "0.9.0"
epoll = ">=4.0.1" epoll = ">=4.0.1"
libc = "0.2.98" libc = "0.2.98"
log = "0.4.14" log = "0.4.14"

View File

@ -16,6 +16,8 @@ use clap::{App, Arg};
use vhost_user_block::start_block_backend; use vhost_user_block::start_block_backend;
fn main() { fn main() {
env_logger::init();
let cmd_arguments = App::new("vhost-user-blk backend") let cmd_arguments = App::new("vhost-user-blk backend")
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())

View File

@ -6,6 +6,7 @@ edition = "2018"
[dependencies] [dependencies]
clap = { version = "2.33.3", features=["wrap_help"] } clap = { version = "2.33.3", features=["wrap_help"] }
env_logger = "0.9.0"
epoll = ">=4.0.1" epoll = ">=4.0.1"
libc = "0.2.98" libc = "0.2.98"
log = "0.4.14" log = "0.4.14"

View File

@ -13,6 +13,8 @@ use clap::{App, Arg};
use vhost_user_net::start_net_backend; use vhost_user_net::start_net_backend;
fn main() { fn main() {
env_logger::init();
let cmd_arguments = App::new("vhost-user-net backend") let cmd_arguments = App::new("vhost-user-net backend")
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())