Struct Logger

Source
pub struct Logger;

Implementations§

Source§

impl Logger

Source

pub fn stdout() -> LoggerStdoutBuilder

Monteur de structure d’un logger de type stdout.

Paramètres activés:

  1. LoggerBuilder::with_color()
  2. LoggerBuilder::with_timestamp()
Examples found in repository?
examples/simple.rs (line 33)
13fn main()
14{
15	/*
16	use lexa_logger::{LoggerInitiator, LoggerStdoutBuilder};
17
18	// NOTE: Aucun paramètres n'est appliqués par défaut, sauf le format des logs.
19	let logger_builder = LoggerStdoutBuilder::default()
20		.with_level(log::LevelFilter::Debug)
21		.with_color(true)
22		.with_timestamp(true)
23	;
24
25	LoggerInitiator::stdout(logger_builder).expect("L'initialisation du logger (stdout)");
26	*/
27
28	// NOTE: Les fonctions de l'implémentation de `Logger` PEUVENT appliquer des
29	// paramètres par défaut au builder. Ici, la fonction `stdout()`, applique
30	// les paramètres suivants: `.with_colorized(true)` et `.with_timestamp(true)`.
31	//
32	// NOTE: ces paramètres PEUVENT être désactivés explicitement ci-dessous.
33	let logger = Logger::stdout();
34
35	// logger.with_...
36	#[cfg(not(feature = "tracing"))]
37	let logger = logger.with_level(log::LevelFilter::Debug);
38	#[cfg(feature = "tracing")]
39	let logger = logger.with_level(tracing::level_filters::LevelFilter::DEBUG);
40
41	// NOTE: L'extension `LoggerStdoutBuilderExtension` ajoute la fonction
42	// `.initialize()` qui elle va s'occuper d'initialiser le logger.
43	// NOTE: Cette fonction PEUT paniquer en cas d'erreur.
44	logger.initialize();
45
46	log::info!("Hello World");
47}

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.