[][src]Struct holochain_logging::FastLoggerBuilder

pub struct FastLoggerBuilder { /* fields omitted */ }

Logger Builder used to correctly set up our logging capability.

Methods

impl<'a> FastLoggerBuilder[src]

use holochain_logging::FastLoggerBuilder;

let logger = FastLoggerBuilder::new()
    .set_level_from_str("Debug")
    .set_channel_size(512)
    .build();

assert!(logger.is_ok());

pub fn new() -> Self[src]

It will init a FastLogger with the default argument (log level set to Info by default).

pub fn from_toml(toml_str: &str) -> Result<Self, Error>[src]

Instantiate a logger builder from a config file in TOML format.

use holochain_logging::FastLoggerBuilder;

let toml = r#"
[logger]
level = "debug"
    [[logger.rules]]
    pattern = ".*"
    color = "red"
"#;

let logger = FastLoggerBuilder::from_toml(toml)
                .expect("Fail to instantiate the logger from toml.");
assert!(logger.build().is_ok());

pub fn level(&self) -> Level[src]

Returns the verbosity level of logger to build. Can be one of: Trace, Debug, Info, Warn or Error.

pub fn set_level(&mut self, level: Level) -> &mut Self[src]

Set the verbosity level of the logger. Value can be one of: Trace, Debug, Info, Warn or Error.

pub fn set_level_from_str(&mut self, level: &str) -> &mut Self[src]

Set the verbosity level of the logger from a string value: Trace, Debug, Info, Warn or Error.

pub fn set_channel_size(&mut self, channel_size: usize) -> &mut Self[src]

Sets the capacity of our bounded message queue (i.e. there is a limit to how many messages it can hold at a time.). By default we use a queue of 1024.

pub fn timestamp_format(&mut self, timestamp_fmt: &str) -> &mut Self[src]

Customize our logging timestamp.

pub fn add_rule_filter(&mut self, rule_filter: RuleFilter) -> &mut Self[src]

Add filtering rules to the logging facility.

pub fn rule_filters(&self) -> &[RuleFilter][src]

Returns all the rules that will be applied to the logger.

pub fn redirect_to_file(&mut self, file_path: &str) -> &mut Self[src]

Redirect log message to the provided file path.

pub fn file_path(&self) -> Option<String>[src]

Returns the file path of the logs in the case we want to redirect them to a file.

pub fn build(&self) -> Result<FastLogger, SetLoggerError>[src]

Registers a FastLogger as the comsumer of log facade so it becomes static and any further mutation are discarded.

pub fn build_test(&self) -> Result<FastLogger, SetLoggerError>[src]

Dull log build, only used for test purposes because it actually doesn't log anything by not registering the logger.

Trait Implementations

impl Default for FastLoggerBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.