Skip to main content

DebugAccess

Trait DebugAccess 

Source
pub trait DebugAccess: Send {
    // Required methods
    fn log_status(&self) -> String;
    fn read_log_tail<'a>(
        &'a self,
        n: usize,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'a>>;
    fn scrub(&self, text: &str) -> String;
    fn dump_status(&self) -> Option<String>;
    fn dump_format_name(&self) -> String;
    fn enable_dump(&mut self, dir: &str) -> Result<String, CommandError>;
    fn set_dump_format(&mut self, format_name: &str) -> Result<(), CommandError>;
}
Expand description

Access to debug/diagnostics state for command handlers.

Implemented by zeph-core on a struct that wraps DebugState. Methods intentionally return strings rather than internal types, keeping zeph-commands free of zeph-core dependencies.

Required Methods§

Source

fn log_status(&self) -> String

Return a formatted human-readable status of the log configuration.

Used by /log to display the current log file path, level, rotation, and max files.

Source

fn read_log_tail<'a>( &'a self, n: usize, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'a>>

Optionally read and return recent log file tail entries (last n lines).

Returns None when log file output is disabled. The implementation performs blocking I/O via spawn_blocking.

Source

fn scrub(&self, text: &str) -> String

Scrub credentials from a string before displaying it.

Delegates to zeph-core’s redact::scrub_content.

Source

fn dump_status(&self) -> Option<String>

Return a description of the current debug dump state.

Returns Some(path_display) if debug dump is active, None otherwise.

Source

fn dump_format_name(&self) -> String

Return the current dump format name (e.g. "json", "raw", "trace").

Source

fn enable_dump(&mut self, dir: &str) -> Result<String, CommandError>

Enable debug dump output to the given directory path.

Returns Ok(path_display) on success.

§Errors

Returns Err(CommandError) when the directory cannot be created or is inaccessible.

Source

fn set_dump_format(&mut self, format_name: &str) -> Result<(), CommandError>

Switch the dump format to one of "json", "raw", or "trace".

§Errors

Returns Err(CommandError) when the format name is unrecognized.

Implementors§