From 3b831ffda363745abf7d2fcb01a1a2486103099f Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Wed, 3 Aug 2022 17:55:48 +0200 Subject: [PATCH] Switch from simplelog to env_logger Signed-off-by: Michal Rostecki --- {{project-name}}/Cargo.toml | 2 +- {{project-name}}/src/main.rs | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/{{project-name}}/Cargo.toml b/{{project-name}}/Cargo.toml index bbb4b57..0491123 100644 --- a/{{project-name}}/Cargo.toml +++ b/{{project-name}}/Cargo.toml @@ -10,11 +10,11 @@ aya-log = "0.1" {{project-name}}-common = { path = "../{{project-name}}-common", features=["user"] } anyhow = "1.0.42" clap = { version = "3.1", features = ["derive"] } +env_logger = "0.9" {%- if program_type == "uprobe" %} libc = "0.2.102" {%- endif %} log = "0.4" -simplelog = "0.12" tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } [[bin]] diff --git a/{{project-name}}/src/main.rs b/{{project-name}}/src/main.rs index 4eeeb44..ed1e90d 100644 --- a/{{project-name}}/src/main.rs +++ b/{{project-name}}/src/main.rs @@ -39,7 +39,6 @@ use aya::programs::SocketFilter; use aya_log::BpfLogger; use clap::Parser; use log::info; -use simplelog::{ColorChoice, ConfigBuilder, LevelFilter, TermLogger, TerminalMode}; use tokio::signal; #[derive(Debug, Parser)] @@ -60,15 +59,7 @@ struct Opt { async fn main() -> Result<(), anyhow::Error> { let opt = Opt::parse(); - TermLogger::init( - LevelFilter::Debug, - ConfigBuilder::new() - .set_target_level(LevelFilter::Error) - .set_location_level(LevelFilter::Error) - .build(), - TerminalMode::Mixed, - ColorChoice::Auto, - )?; + env_logger::init(); // This will include your eBPF object file as raw bytes at compile-time and load it at // runtime. This approach is recommended for most real-world use cases. If you would