[][src]Function log4rs_gelf::init_file

pub fn init_file<P>(
    path: P,
    deserializers: Option<Deserializers>
) -> Result<(), Error> where
    P: AsRef<Path>, 

Initializes the global logger as a log4rs logger configured via a file.

Configuration is read from a file located at the provided path on the filesystem and components are created from the provided Deserializers.

Any nonfatal errors encountered when processing the configuration are reported to stderr.

Warning

The logging system may only be initialized once.

Example

extern crate log4rs_gelf;

fn main() {
    log4rs_gelf::init_file("/tmp/log4rs.yml", None).unwrap();

    // Do whatever

    log4rs_gelf::flush().expect("Failed to send buffer, log records can be lost !");
}