chore: format console/log

This commit is contained in:
Paul Pan 2024-02-16 18:16:03 +08:00
parent 0c14eaa057
commit cd6b773326
2 changed files with 2 additions and 5 deletions

View File

@ -44,8 +44,7 @@ impl Log for SimpleLogger {
} }
pub fn init() { pub fn init() {
static LOGGER: SimpleLogger = SimpleLogger; log::set_logger(&SimpleLogger).unwrap();
log::set_logger(&LOGGER).unwrap();
// TODO: get log level from boot env // TODO: get log level from boot env
log::set_max_level(LevelFilter::Trace); log::set_max_level(LevelFilter::Trace);

View File

@ -1,15 +1,13 @@
pub struct RawConsole pub struct RawConsole
where RawConsole: Printer; where RawConsole: Printer + Reader;
pub trait Printer: core::fmt::Write { pub trait Printer: core::fmt::Write {
fn put_char(c: char); fn put_char(c: char);
#[inline]
fn put_str(s: &str) { fn put_str(s: &str) {
s.chars().for_each(Self::put_char); s.chars().for_each(Self::put_char);
} }
#[inline]
fn put_line(s: &str) { fn put_line(s: &str) {
Self::put_str(s); Self::put_str(s);
Self::put_char('\n'); Self::put_char('\n');