Skip to main content

LogStore

Trait LogStore 

Source
pub trait LogStore {
    // Required methods
    fn add_log(
        &self,
        log_id: &str,
        log_source: Arc<Box<dyn LogSource + Send + Sync>>,
        format: Option<&String>,
        enabled: bool,
    );
    fn add_line(&self, log_id: &str, line: &str);
    fn add_lines(&self, log_id: &str, lines: &[String]) -> Range<usize>;
    fn get_format(&self, log_id: &str) -> Option<String>;
    fn get_logs(&self) -> Vec<(bool, String, Option<String>)>;
    fn get_source(
        &self,
        id: &str,
    ) -> Option<Arc<Box<dyn LogSource + Send + Sync>>>;
    fn get_lines(&self, log_id: &str) -> Vec<String>;
    fn extract_lines(&self, log_id: &str) -> Vec<String>;
    fn get_total_lines(&self) -> usize;
    fn toggle_log(&self, log_id: &str);
}
Expand description

Store holding raw information

Manages raw lines and associated format

Required Methods§

Source

fn add_log( &self, log_id: &str, log_source: Arc<Box<dyn LogSource + Send + Sync>>, format: Option<&String>, enabled: bool, )

Add a new log to the store

Source

fn add_line(&self, log_id: &str, line: &str)

Add a single line to the given log id

Source

fn add_lines(&self, log_id: &str, lines: &[String]) -> Range<usize>

Add a many lines to the given log id

Source

fn get_format(&self, log_id: &str) -> Option<String>

Get the format associated to the given log id

Source

fn get_logs(&self) -> Vec<(bool, String, Option<String>)>

Get a list of (enabled, log_id, format(if any))

Source

fn get_source(&self, id: &str) -> Option<Arc<Box<dyn LogSource + Send + Sync>>>

Get the log source associated to the log id

Source

fn get_lines(&self, log_id: &str) -> Vec<String>

Get a list of all the lines for the requested log. WARNING: clones

Source

fn extract_lines(&self, log_id: &str) -> Vec<String>

Get a list of all the lines for the requested log. WARNING: moves

Source

fn get_total_lines(&self) -> usize

Get the count of all the lines

Source

fn toggle_log(&self, log_id: &str)

Change the enabled state of the given log

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§