Skip to main content

init

Function init 

Source
pub fn init(
    cap: usize,
    formatter: fn(content: &str, level: &str, color: Color, strong: bool) -> String,
) -> JoinHandle<()>
Expand description

The function creates a logging thread.

The get_logger function will be usable after init is called.

§Close

To close the logger thread, just call [li_logger::close()].

All Logger will not be usable after close is called.

§Example

use li_logger::default_formatter;
 
#[tokio::main]
async fn main() {
 
    let handle = li_logger::init(100, default_formatter);
    let mut logger = li_logger::get_logger();
     
    logger.success("Li Logger Started!");
     
    li_logger::close();
    handle.await;
}
``