Skip to main content

TestLogger

Struct TestLogger 

Source
pub struct TestLogger { /* private fields */ }
Expand description

Thread-safe test logger that captures logs during E2E tests

Implementations§

Source§

impl TestLogger

Source

pub fn new(test_name: &str, config: LoggerConfig) -> Self

Create a new test logger with the given configuration

Source

pub fn default_for_test(test_name: &str) -> Self

Create a logger with default configuration

Source

pub fn test_name(&self) -> &str

Get the test name

Source

pub fn elapsed(&self) -> Duration

Get elapsed time since logger creation

Source

pub fn log( &self, level: LogLevel, source: LogSource, message: impl Into<String>, )

Log an entry with the given level and source

Source

pub fn log_with_context( &self, level: LogLevel, source: LogSource, message: impl Into<String>, context: Vec<(String, String)>, )

Log an entry with context key-value pairs

Source

pub fn reliability_log_path(&self) -> Option<&Path>

Returns the reliability JSONL path if reliability logging is enabled.

Source

pub fn log_reliability_event( &self, input: ReliabilityEventInput, ) -> ReliabilityPhaseEvent

Emit a structured reliability event using the stable schema contract.

Source

pub fn capture_artifact_text( &self, scenario_id: &str, artifact_name: &str, content: &str, ) -> Result<PathBuf>

Persist a text artifact for replay/postmortem analysis.

Source

pub fn capture_artifact_json<T: Serialize>( &self, scenario_id: &str, artifact_name: &str, value: &T, ) -> Result<PathBuf>

Persist a JSON artifact for replay/postmortem analysis.

Source

pub fn trace(&self, message: impl Into<String>)

Log a trace message from the harness

Source

pub fn debug(&self, message: impl Into<String>)

Log a debug message from the harness

Source

pub fn info(&self, message: impl Into<String>)

Log an info message from the harness

Source

pub fn warn(&self, message: impl Into<String>)

Log a warning message from the harness

Source

pub fn error(&self, message: impl Into<String>)

Log an error message from the harness

Source

pub fn log_stdout( &self, process_name: &str, pid: u32, message: impl Into<String>, )

Log process stdout

Source

pub fn log_stderr( &self, process_name: &str, pid: u32, message: impl Into<String>, )

Log process stderr

Source

pub fn log_daemon(&self, level: LogLevel, message: impl Into<String>)

Log a daemon message

Source

pub fn log_worker( &self, worker_id: &str, level: LogLevel, message: impl Into<String>, )

Log a worker message

Source

pub fn log_hook(&self, level: LogLevel, message: impl Into<String>)

Log a hook message

Source

pub fn entries(&self) -> Vec<LogEntry>

Get all log entries

Source

pub fn entries_by_level(&self, min_level: LogLevel) -> Vec<LogEntry>

Get entries filtered by level

Source

pub fn entries_by_source(&self, source_prefix: &str) -> Vec<LogEntry>

Get entries filtered by source

Source

pub fn search(&self, pattern: &str) -> Vec<LogEntry>

Search entries by message content

Source

pub fn has_errors(&self) -> bool

Check if any errors were logged

Source

pub fn error_count(&self) -> usize

Get error count

Source

pub fn warn_count(&self) -> usize

Get warning count

Source

pub fn clear(&self)

Clear all entries

Source

pub fn export_json(&self) -> String

Export logs to JSON

Source

pub fn export_json_to_file(&self, path: &Path) -> Result<()>

Export logs to a JSON file

Source

pub fn summary(&self) -> TestLogSummary

Generate a test summary

Source

pub fn print_summary(&self)

Print a formatted summary to stdout

Trait Implementations§

Source§

impl Clone for TestLogger

Source§

fn clone(&self) -> TestLogger

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more