Skip to content

Commit 55cfce6

Browse files
author
Jiajie Chen
committed
Show target in logging, and fix console deadlock
1 parent c881bdc commit 55cfce6

File tree

4 files changed

+34
-23
lines changed

4 files changed

+34
-23
lines changed

kernel/Cargo.lock

Lines changed: 11 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kernel/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ isomorphic_drivers = { git = "https://github.com/rcore-os/isomorphic_drivers", f
6161
lazy_static = { version = "1.3", features = ["spin_no_std"] }
6262
smoltcp = { git = "https://github.com/rcore-os/smoltcp", default-features = false, features = ["alloc", "log", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw"] }
6363
bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator" }
64-
rcore-console = { git = "https://github.com/rcore-os/rcore-console", rev = "f09eae7" }
64+
rcore-console = { git = "https://github.com/rcore-os/rcore-console", rev = "18402290", default-features = false }
6565
rcore-memory = { path = "../crate/memory" }
6666
rcore-thread = { git = "https://github.com/rcore-os/rcore-thread" }
6767
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "33f86c47" }
@@ -79,8 +79,8 @@ x86_64 = "0.7"
7979
raw-cpuid = "6.0"
8080
uart_16550 = "0.2"
8181
pc-keyboard = "0.5"
82-
acpi = "0.3"
83-
aml_parser = "0.3"
82+
acpi = "0.4"
83+
aml = "0.4"
8484

8585
[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
8686
riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }

kernel/src/drivers/gpu/fb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ impl Framebuffer {
251251
}
252252
}
253253

254-
use rcore_console::Rgb888;
255254
use rcore_console::embedded_graphics::prelude::*;
255+
use rcore_console::Rgb888;
256256

257257
/// To be the backend of rCore `Console`
258258
impl Drawing<Rgb888> for Framebuffer {

kernel/src/logging.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,26 @@ impl Log for SimpleLogger {
6565
if !self.enabled(record.metadata()) {
6666
return;
6767
}
68+
6869
if let Some(tid) = processor().tid_option() {
6970
print_in_color(
70-
format_args!("[{:>5}][{}] {}\n", record.level(), tid, record.args()),
71+
format_args!(
72+
"[{:>5}][{}][{}] {}\n",
73+
record.level(),
74+
tid,
75+
record.target(),
76+
record.args()
77+
),
7178
level_to_color_code(record.level()),
7279
);
7380
} else {
7481
print_in_color(
75-
format_args!("[{:>5}][-] {}\n", record.level(), record.args()),
82+
format_args!(
83+
"[{:>5}][-][{}] {}\n",
84+
record.level(),
85+
record.target(),
86+
record.args()
87+
),
7688
level_to_color_code(record.level()),
7789
);
7890
}
@@ -82,10 +94,10 @@ impl Log for SimpleLogger {
8294

8395
fn level_to_color_code(level: Level) -> u8 {
8496
match level {
85-
Level::Error => 31, // Red
86-
Level::Warn => 93, // BrightYellow
87-
Level::Info => 34, // Blue
88-
Level::Debug => 32, // Green
89-
Level::Trace => 90, // BrightBlack
97+
Level::Error => 31, // Red
98+
Level::Warn => 93, // BrightYellow
99+
Level::Info => 34, // Blue
100+
Level::Debug => 32, // Green
101+
Level::Trace => 90, // BrightBlack
90102
}
91103
}

0 commit comments

Comments
 (0)