[][src]Function gelf_logger::init

pub fn init(cfg: Config) -> Result<(), Error>

Initialize the logger using the given Config.

Warning

The logging system may only be initialized once.

Example

use gelf_logger::Config;

fn main() {
    let cfg = Config::builder()
        .set_hostname("myhost.com".into())
        .set_port(12202)
        .build();

    gelf_logger::init(cfg).unwrap();

    info!("hello");

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