Skip to content

Commit 551e24a

Browse files
authored
move the actor logs into the trace (#2098)
1 parent ed6d34a commit 551e24a

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

fvm/src/call_manager/default.rs

+4
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,10 @@ where
513513

514514
Ok(())
515515
}
516+
517+
fn log(&mut self, msg: String) {
518+
self.trace(ExecutionEvent::Log(msg))
519+
}
516520
}
517521

518522
impl<M> DefaultCallManager<M>

fvm/src/call_manager/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ pub trait CallManager: 'static {
174174

175175
/// Appends an event to the event accumulator.
176176
fn append_event(&mut self, evt: StampedEvent);
177+
178+
/// log
179+
fn log(&mut self, msg: String);
177180
}
178181

179182
/// The result of calling actor's entrypoint

fvm/src/kernel/default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,8 @@ impl<C> DebugOps for DefaultKernel<C>
951951
where
952952
C: CallManager,
953953
{
954-
fn log(&self, msg: String) {
955-
println!("{}", msg)
954+
fn log(&mut self, msg: String) {
955+
self.call_manager.log(msg)
956956
}
957957

958958
fn debug_enabled(&self) -> bool {

fvm/src/kernel/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pub trait RandomnessOps {
285285
#[delegatable_trait]
286286
pub trait DebugOps {
287287
/// Log a message.
288-
fn log(&self, msg: String);
288+
fn log(&mut self, msg: String);
289289

290290
/// Returns whether debug mode is enabled.
291291
fn debug_enabled(&self) -> bool;

fvm/src/trace/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ pub enum ExecutionEvent {
3838
id: ActorID,
3939
state: ActorState,
4040
},
41+
Log(String),
4142
}

fvm/tests/dummy.rs

+4
Original file line numberDiff line numberDiff line change
@@ -404,4 +404,8 @@ impl CallManager for DummyCallManager {
404404
) -> fvm::kernel::Result<()> {
405405
todo!()
406406
}
407+
408+
fn log(&mut self, _msg: String) {
409+
todo!()
410+
}
407411
}

0 commit comments

Comments
 (0)