Skip to content

Commit

Permalink
move the actor logs into the trace
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyunha committed Dec 10, 2024
1 parent ed6d34a commit 3870f87
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions fvm/src/call_manager/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ where

Ok(())
}

fn log(&mut self, msg: String) {
self.trace(ExecutionEvent::Log(msg))
}
}

impl<M> DefaultCallManager<M>
Expand Down
3 changes: 3 additions & 0 deletions fvm/src/call_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ pub trait CallManager: 'static {

/// Appends an event to the event accumulator.
fn append_event(&mut self, evt: StampedEvent);

/// log
fn log(&mut self, msg: String);
}

/// The result of calling actor's entrypoint
Expand Down
4 changes: 2 additions & 2 deletions fvm/src/kernel/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,8 @@ impl<C> DebugOps for DefaultKernel<C>
where
C: CallManager,
{
fn log(&self, msg: String) {
println!("{}", msg)
fn log(&mut self, msg: String) {
self.call_manager.log(msg)
}

fn debug_enabled(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion fvm/src/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ pub trait RandomnessOps {
#[delegatable_trait]
pub trait DebugOps {
/// Log a message.
fn log(&self, msg: String);
fn log(&mut self, msg: String);

/// Returns whether debug mode is enabled.
fn debug_enabled(&self) -> bool;
Expand Down
1 change: 1 addition & 0 deletions fvm/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ pub enum ExecutionEvent {
id: ActorID,
state: ActorState,
},
Log(String),
}
4 changes: 4 additions & 0 deletions fvm/tests/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,8 @@ impl CallManager for DummyCallManager {
) -> fvm::kernel::Result<()> {
todo!()
}

fn log(&mut self, _msg: String) {
todo!()
}
}

0 comments on commit 3870f87

Please sign in to comment.