Skip to main content

LogFormat

Struct LogFormat 

Source
pub struct LogFormat {
    pub name: String,
    pub regex: Regex,
    pub field_names: Vec<String>,
    pub display: Option<DisplayTemplate>,
    pub record_start: Option<Regex>,
    pub prompt: Option<ParsedPrompt>,
    pub prompt_style: Option<Style>,
    /* private fields */
}
Expand description

A named log format: a regex with named capture groups identifying the fields of one log line. Used by filtering to look up field values by name.

Fields§

§name: String§regex: Regex§field_names: Vec<String>

Capture group names declared in the regex, in declaration order. Used by --list-formats to show users what fields are available.

§display: Option<DisplayTemplate>

Optional default display template (display key in formats.toml). When set and no CLI override is given, the viewer / batch output renders each parsed line through this template instead of the raw line.

§record_start: Option<Regex>§prompt: Option<ParsedPrompt>

Optional default status-line prompt template (prompt key in formats.toml). When set and no --prompt CLI flag is given, the viewport renders the status line through this template instead of the built-in default.

§prompt_style: Option<Style>

Optional default style for the status row when this format’s prompt is active. Per-format value; CLI --prompt-style overrides.

Implementations§

Source§

impl LogFormat

Source

pub fn compile(name: &str, pattern: &str) -> Result<Self, String>

Source

pub fn compile_with_display( name: &str, pattern: &str, display: Option<&str>, ) -> Result<Self, String>

Source

pub fn compile_full( name: &str, pattern: &str, display: Option<&str>, record_start: Option<&str>, prompt: Option<&str>, ) -> Result<Self, String>

Trait Implementations§

Source§

impl Debug for LogFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.