Skip to main content

new_logger

Function new_logger 

Source
pub fn new_logger(
    cfg: &Config,
) -> Result<(Dispatch, Box<dyn Write + Send>), LoggerError>
Expand description

Ported from NewLogger. Returns the writer’s Drop/close handle alongside the logger, mirroring Go’s io.Closer return value.

Builds a real LoggerSubscriber wired to cfg’s format, level, colour, and add_source settings, sharing the same underlying Write destination between the returned Dispatch and the returned closer handle so a caller can log through the dispatch and then read back exactly what was written (via the closer, or directly from a File output’s path).