Logger

Struct Logger 

Source
pub struct Logger { /* private fields */ }
Expand description

ftlog global logger

Implementations§

Source§

impl Logger

Source

pub fn init(self) -> Result<LoggerGuard, SetLoggerError>

Examples found in repository?
examples/lazy-bench.rs (line 40)
33fn main() {
34    let _guard = ftlog::Builder::new()
35        .root(std::io::sink())
36        .bounded(100_000, false)
37        // .unbounded()
38        .build()
39        .unwrap()
40        .init()
41        .unwrap();
42    run!("static string", {
43        ftlog::info!("ftlog message");
44    });
45    run!("with i32", {
46        ftlog::info!("ftlog: {}", 0i32);
47    });
48    run!("limit with i32", {
49        ftlog::info!(limit=3i64; "ftlog: {}", 0i32);
50    });
51}
More examples
Hide additional examples
examples/string-bench.rs (line 56)
48fn main() {
49    let _guard = ftlog::Builder::new()
50        .root(std::io::sink())
51        .format(StringFormatter)
52        .bounded(100_000, false)
53        // .unbounded()
54        .build()
55        .unwrap()
56        .init()
57        .unwrap();
58    run!("static string", {
59        ftlog::info!("ftlog message");
60    });
61    run!("with i32", {
62        ftlog::info!("ftlog: {}", 0i32);
63    });
64    run!("limit with i32", {
65        ftlog::info!(limit=3i64; "ftlog: {}", 0i32);
66    });
67}

Trait Implementations§

Source§

impl Log for Logger

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. Read more

Auto Trait Implementations§

§

impl !Freeze for Logger

§

impl !RefUnwindSafe for Logger

§

impl Send for Logger

§

impl Sync for Logger

§

impl Unpin for Logger

§

impl !UnwindSafe for Logger

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.