Struct redox_log::RedoxLogger

source ·
pub struct RedoxLogger { /* private fields */ }

Implementations§

source§

impl RedoxLogger

source

pub fn new() -> Self

Examples found in repository?
examples/simple/main.rs (line 7)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fn main() {
    dbg!(RedoxLogger::new()
        .with_output(
            OutputBuilder::with_endpoint(
                File::create("file.log").expect("failed to open log file")
            )
            .with_filter(log::LevelFilter::Trace)
            .build()
        )
        .with_output(
            OutputBuilder::stdout()
                .with_filter(log::LevelFilter::Debug)
                .with_ansi_escape_codes()
                .build()
        )
        .with_process_name("simple".into())
        .enable().expect("failed to enable"));
    info!("Example started");
    debug!("example started with log file: {}", "file.log");
    trace!("useless comment");
    warn!("useless comment is useless");
    error!("deadlock");
    loop {}
}
source

pub fn with_output(self, output: Output) -> Self

Examples found in repository?
examples/simple/main.rs (lines 8-14)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fn main() {
    dbg!(RedoxLogger::new()
        .with_output(
            OutputBuilder::with_endpoint(
                File::create("file.log").expect("failed to open log file")
            )
            .with_filter(log::LevelFilter::Trace)
            .build()
        )
        .with_output(
            OutputBuilder::stdout()
                .with_filter(log::LevelFilter::Debug)
                .with_ansi_escape_codes()
                .build()
        )
        .with_process_name("simple".into())
        .enable().expect("failed to enable"));
    info!("Example started");
    debug!("example started with log file: {}", "file.log");
    trace!("useless comment");
    warn!("useless comment is useless");
    error!("deadlock");
    loop {}
}
source

pub fn with_min_level_override(self, min: LevelFilter) -> Self

source

pub fn with_max_level_override(self, max: LevelFilter) -> Self

source

pub fn with_process_name(self, name: String) -> Self

Examples found in repository?
examples/simple/main.rs (line 21)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fn main() {
    dbg!(RedoxLogger::new()
        .with_output(
            OutputBuilder::with_endpoint(
                File::create("file.log").expect("failed to open log file")
            )
            .with_filter(log::LevelFilter::Trace)
            .build()
        )
        .with_output(
            OutputBuilder::stdout()
                .with_filter(log::LevelFilter::Debug)
                .with_ansi_escape_codes()
                .build()
        )
        .with_process_name("simple".into())
        .enable().expect("failed to enable"));
    info!("Example started");
    debug!("example started with log file: {}", "file.log");
    trace!("useless comment");
    warn!("useless comment is useless");
    error!("deadlock");
    loop {}
}
source

pub fn enable(self) -> Result<&'static Self, SetLoggerError>

Examples found in repository?
examples/simple/main.rs (line 22)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fn main() {
    dbg!(RedoxLogger::new()
        .with_output(
            OutputBuilder::with_endpoint(
                File::create("file.log").expect("failed to open log file")
            )
            .with_filter(log::LevelFilter::Trace)
            .build()
        )
        .with_output(
            OutputBuilder::stdout()
                .with_filter(log::LevelFilter::Debug)
                .with_ansi_escape_codes()
                .build()
        )
        .with_process_name("simple".into())
        .enable().expect("failed to enable"));
    info!("Example started");
    debug!("example started with log file: {}", "file.log");
    trace!("useless comment");
    warn!("useless comment is useless");
    error!("deadlock");
    loop {}
}

Trait Implementations§

source§

impl Debug for RedoxLogger

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for RedoxLogger

source§

fn default() -> RedoxLogger

Returns the “default value” for a type. Read more
source§

impl Log for RedoxLogger

source§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be logged. Read more
source§

fn log(&self, record: &Record<'_>)

Logs the Record. Read more
source§

fn flush(&self)

Flushes any buffered records.

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

§

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

§

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.