Merge pull request #736 from aya-rs/logging-better

Remove pointless DefaultLogger
reviewable/pr723/r8
Tamir Duberstein 1 year ago committed by GitHub
commit 45df2519b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -98,7 +98,7 @@ impl BpfLogger {
/// Starts reading log records created with `aya-log-ebpf` and logs them /// Starts reading log records created with `aya-log-ebpf` and logs them
/// with the default logger. See [log::logger]. /// with the default logger. See [log::logger].
pub fn init(bpf: &mut Bpf) -> Result<BpfLogger, Error> { pub fn init(bpf: &mut Bpf) -> Result<BpfLogger, Error> {
BpfLogger::init_with_logger(bpf, DefaultLogger {}) BpfLogger::init_with_logger(bpf, log::logger())
} }
/// Starts reading log records created with `aya-log-ebpf` and logs them /// Starts reading log records created with `aya-log-ebpf` and logs them
@ -356,23 +356,6 @@ macro_rules! impl_format_float {
impl_format_float!(f32); impl_format_float!(f32);
impl_format_float!(f64); impl_format_float!(f64);
#[derive(Copy, Clone, Debug)]
struct DefaultLogger;
impl Log for DefaultLogger {
fn enabled(&self, metadata: &log::Metadata) -> bool {
log::logger().enabled(metadata)
}
fn log(&self, record: &Record) {
log::logger().log(record)
}
fn flush(&self) {
log::logger().flush()
}
}
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum Error { pub enum Error {
#[error("log event array {} doesn't exist", MAP_NAME)] #[error("log event array {} doesn't exist", MAP_NAME)]

Loading…
Cancel
Save