create_stdout_logger

Function create_stdout_logger 

Source
pub fn create_stdout_logger() -> Result<LoggerHandle, Box<dyn Error>>
Expand description

Creates a logger that outputs to stdout.

This function initializes a logger using the flexi_logger crate, which logs messages to the standard output (stdout). Logger’s log level is set based on the environment variable or defaults to “info”.

§Returns

A Result containing a flexi_logger::LoggerHandle if the logger is successfully initialized, or a boxed dyn std::error::Error if an error occurs.

§Errors

This function will return an error if the logger fails to initialize.

§Examples

use libits::client::logger::create_stdout_logger;
let _logger = create_stdout_logger().expect("Logger initialization failed");

§Dependencies

This function requires the flexi_logger and log crates.

§Notes

Logger is configured to print messages to stdout and includes a message indicating that the logger is ready.

§See Also

  • flexi_logger::Logger
  • log::info