pub struct EventLoopLogger { /* private fields */ }Expand description
Logger for recording event loop execution.
This logger writes a human-readable log of the event loop’s progression:
- which effects ran
- what events were emitted
- how long each effect took
- what phase/iteration/retry context was active
The log is always-on (not just for crashes) and is written to
.agent/logs-<run_id>/event_loop.log for easy diagnosis.
Redaction: This logger must never include sensitive content like prompts, agent outputs, secrets, or credentials.
Implementations§
Source§impl EventLoopLogger
impl EventLoopLogger
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new EventLoopLogger.
The sequence counter starts at 1 for the first logged effect.
Sourcepub fn from_existing_log(
workspace: &dyn Workspace,
log_path: &Path,
) -> Result<Self, Error>
pub fn from_existing_log( workspace: &dyn Workspace, log_path: &Path, ) -> Result<Self, Error>
Create a new EventLoopLogger that continues from an existing log file.
This reads the last sequence number from the existing log file
and starts the counter from last_seq + 1. This is important
for resume scenarios to maintain monotonically increasing sequence
numbers within a run.
§Arguments
workspace- Workspace implementation for reading the log filelog_path- Path to the existing event loop log file
§Returns
Ok(EventLoopLogger)- Logger initialized with next sequence numberErr(std::io::Error)- If reading the log file fails
§Behavior
- If the log file doesn’t exist or is empty, starts at seq=1
- If the log file exists, reads the last line to extract the sequence number
- If the last line doesn’t match the expected format, starts at seq=1
- The sequence counter is set to
last_seq + 1to continue the sequence
Sourcepub fn log_effect(&mut self, params: LogEffectParams<'_>) -> Result<(), Error>
pub fn log_effect(&mut self, params: LogEffectParams<'_>) -> Result<(), Error>
Log an effect execution.
This writes a single line to the event loop log with the following format:
<seq> ts=<rfc3339> phase=<Phase> effect=<Effect> event=<Event> [extra=[E1,E2]] [ctx=k1=v1,k2=v2] ms=<N>Example:
1 ts=2026-02-06T14:03:27.123Z phase=Development effect=InvokePrompt event=PromptCompleted ms=1234
2 ts=2026-02-06T14:03:28.456Z phase=Development effect=WriteFile event=FileWritten ctx=file=PLAN.md ms=12§Best-Effort Logging
Write failures are returned but do not affect pipeline correctness. This is intentional: event loop logging is observability-only and must not affect pipeline correctness. If logging fails (e.g., disk full, permissions), the pipeline continues execution.
Callers who want visibility into logging failures should check the return value and log to the pipeline logger if desired.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventLoopLogger
impl RefUnwindSafe for EventLoopLogger
impl Send for EventLoopLogger
impl Sync for EventLoopLogger
impl Unpin for EventLoopLogger
impl UnwindSafe for EventLoopLogger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more