Skip to content

Commit

Permalink
remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Jul 30, 2022
1 parent 9366c9b commit e38f246
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
1 change: 0 additions & 1 deletion hermit-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ trace = []
vga = []

[dependencies]
log = { version = "0.4", default-features = false }
libm = { version = "0.2", default-features = false }

rftrace = { version = "0.1", optional = true, features = ["autokernel", "buildcore", "interruptsafe"] }
Expand Down
38 changes: 1 addition & 37 deletions hermit-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,13 @@
#![allow(clippy::large_enum_variant)]
#![allow(clippy::new_ret_no_self)]

#[macro_use]
extern crate log;

mod cmath;
#[cfg(not(feature = "tcp"))]
mod dummy;

use log::{set_logger, set_max_level, LevelFilter, Metadata, Record};

/// Data structure to filter kernel messages
struct SysLogger;

impl log::Log for SysLogger {
fn enabled(&self, _: &Metadata) -> bool {
true
}

fn flush(&self) {
// nothing to do
}

fn log(&self, record: &Record) {
if self.enabled(record.metadata()) {
println!("[{}] {}", record.level(), record.args());
}
}
}

#[no_mangle]
pub extern "C" fn sys_network_init() -> i32 {
set_logger(&SysLogger).expect("Can't initialize logger");
// Determines LevelFilter at compile time
let log_level: Option<&'static str> = option_env!("HERMIT_LOG_LEVEL_FILTER");
let max_level: LevelFilter = match log_level {
Some("Error") => LevelFilter::Error,
Some("Debug") => LevelFilter::Debug,
Some("Off") => LevelFilter::Off,
Some("Trace") => LevelFilter::Trace,
Some("Warn") => LevelFilter::Warn,
Some("Info") => LevelFilter::Info,
_ => LevelFilter::Info,
};
set_max_level(max_level);
// nothing to do

0
}

0 comments on commit e38f246

Please sign in to comment.