Commit aa9fbd79 authored by Stefan Lankes's avatar Stefan Lankes
Browse files

switch back to log 0.3

parent 11d6993a
......@@ -22,17 +22,18 @@ vga = []
[dependencies]
bitflags = "1.0.*"
spin = "0.5"
#byteorder = { version = "1.0", default-features = false }
[dependencies.log]
version = "0.4"
version = "0.3"
default-features = false
features = ["max_level_trace", "release_max_level_info"]
#features = ["release_max_level_info"]
[dependencies.smoltcp]
git = "https://github.com/hermitcore/smoltcp.git"
branch = "hermit"
version = "0.5"
default-features = false
features = ["log", "alloc", "socket-raw", "socket-udp", "socket-tcp", "proto-ipv4", "proto-dhcpv4"]
features = ["log", "verbose", "alloc", "socket-udp", "socket-tcp", "proto-ipv4", "proto-dhcpv4"]
# for debugging: "log", "verbose"
[target.'cfg(target_arch = "x86_64")'.dependencies.hermit-multiboot]
git = "https://github.com/hermitcore/multiboot.git"
......@@ -51,9 +52,9 @@ opt-level = 1 # controls the `--opt-level` the compiler builds with
debug = true # controls whether the compiler passes `-C debuginfo`
# a value of `true` is equivalent to `2`
rpath = false # controls whether the compiler passes `-C rpath`
lto = false # controls `-C lto` for binaries and staticlibs
lto = false # controls `-C lto` for binaries and staticlibs
debug-assertions = true # controls whether debug assertions are enabled
codegen-units = 1 # controls whether the compiler passes `-C codegen-units`
codegen-units = 1 # controls whether the compiler passes `-C codegen-units`
# `codegen-units` is ignored when `lto = true`
# The release profile, used for `cargo build --release`.
......@@ -63,4 +64,3 @@ debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
......@@ -6,31 +6,30 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
use log::{Record, Level, Metadata, LevelFilter};
use log::{set_logger_raw, LogLevelFilter, LogMetadata, LogRecord};
/// Data structures to filter kernel messages
/// Data structure to filter kernel messages
struct KernelLogger;
/// default logger to handle kernel messages
static LOGGER: KernelLogger = KernelLogger;
impl log::Log for KernelLogger {
fn enabled(&self, metadata: &Metadata) -> bool {
metadata.level() <= Level::Info
fn enabled(&self, _: &LogMetadata) -> bool {
true
}
fn log(&self, record: &Record) {
fn log(&self, record: &LogRecord) {
if self.enabled(record.metadata()) {
println!("[{}][{}] {}", crate::arch::percore::core_id(), record.level(), record.args());
}
}
fn flush(&self) {}
}
pub fn init() {
log::set_logger(&LOGGER)
.map(|()| log::set_max_level(LevelFilter::Info)).unwrap();
unsafe {
set_logger_raw(|max_log_level| {
max_log_level.set(LogLevelFilter::Info);
&KernelLogger
}).expect("Can't initialize logger");
}
}
macro_rules! infoheader {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment