automerge
This commit is contained in:
16
runtime/src/log_collector.rs
Normal file
16
runtime/src/log_collector.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct LogCollector {
|
||||
messages: RefCell<Vec<String>>,
|
||||
}
|
||||
|
||||
impl LogCollector {
|
||||
pub fn log(&self, message: &str) {
|
||||
self.messages.borrow_mut().push(message.to_string())
|
||||
}
|
||||
|
||||
pub fn output(self) -> Vec<String> {
|
||||
self.messages.into_inner()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user