From 7240198a546865fe262feea32df060fcffef558a Mon Sep 17 00:00:00 2001 From: WangRunji Date: Fri, 21 Dec 2018 19:02:50 +0800 Subject: [PATCH] fix newline: '\r\n' --- kernel/src/logging.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/src/logging.rs b/kernel/src/logging.rs index 8bb2f97..51b0b7d 100644 --- a/kernel/src/logging.rs +++ b/kernel/src/logging.rs @@ -30,15 +30,15 @@ macro_rules! print { #[macro_export] macro_rules! println { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => (print!(concat!($fmt, "\r\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\r\n"), $($arg)*)); } /// Add escape sequence to print with color in Linux console macro_rules! with_color { ($args: ident, $color: ident) => {{ let (show, code) = color_to_console_code($color); - format_args!("{}[{};{}m{}{}[0m", 27 as char, show.clone(), code + 30, $args, 27 as char) + format_args!("\u{1B}[{};{}m{}\u{1B}[0m", show.clone(), code + 30, $args) }}; } @@ -67,7 +67,7 @@ impl Log for SimpleLogger { if self.enabled(record.metadata()) && !DISABLED_TARGET.contains(&record.target()) { // let target = record.target(); // let begin = target.as_bytes().iter().rposition(|&c| c == b':').map(|i| i + 1).unwrap_or(0); - print_in_color(format_args!("[{:>5}] {}\n", record.level(), record.args()), Color::from(record.level())); + print_in_color(format_args!("[{:>5}] {}\r\n", record.level(), record.args()), Color::from(record.level())); } } fn flush(&self) {}