forked from M-Labs/artiq
1
0
Fork 0

Rust: aggregate kernel CPU log messages and print line by line.

This commit is contained in:
whitequark 2016-10-06 10:56:19 +00:00
parent 3362887d75
commit 2ae30b5a95
1 changed files with 14 additions and 4 deletions

View File

@ -55,7 +55,8 @@ enum KernelState {
struct Session<'a> { struct Session<'a> {
congress: &'a mut Congress, congress: &'a mut Congress,
kernel_state: KernelState, kernel_state: KernelState,
watchdog_set: clock::WatchdogSet watchdog_set: clock::WatchdogSet,
log_buffer: String
} }
impl<'a> Session<'a> { impl<'a> Session<'a> {
@ -63,7 +64,8 @@ impl<'a> Session<'a> {
Session { Session {
congress: congress, congress: congress,
kernel_state: KernelState::Absent, kernel_state: KernelState::Absent,
watchdog_set: clock::WatchdogSet::new() watchdog_set: clock::WatchdogSet::new(),
log_buffer: String::new()
} }
} }
@ -286,8 +288,16 @@ fn process_kern_message(waiter: Waiter,
trace!("comm<-kern {:?}", request); trace!("comm<-kern {:?}", request);
match request { match request {
kern::Log(log) => { kern::Log(log) => {
info!(target: "kernel", "{}", log); session.log_buffer += log;
kern_acknowledge() try!(kern_acknowledge());
if &log[log.len() - 1..] == "\n" {
for line in session.log_buffer.lines() {
info!(target: "kernel", "{}", line);
}
session.log_buffer.clear()
}
Ok(())
} }
kern::NowInitRequest => kern::NowInitRequest =>