Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move the actor logs into the trace #2098

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!()
}
}
Loading