slog-gelf

Crates.ioslog-gelf
lib.rsslog-gelf
version0.1.2
sourcesrc
created_at2019-06-18 12:39:39.929233
updated_at2019-07-25 18:47:15.101308
descriptionGELF drain for slog
homepagehttps://github.com/lancastr/slog-gelf
repositoryhttps://github.com/lancastr/slog-gelf
max_upload_size
id141934
size26,696
Gleb Pomykalov (glebpom)

documentation

README

slog-gelf - A GELF integration for slog-rs

Build Status

How to use

#[macro_use]
extern crate slog;
extern crate hostname;
extern crate slog_async;
extern crate slog_gelf;

use slog::Drain;

fn main() {
    let hostname = hostname::get_hostname().unwrap();

    let drain = slog_gelf::Gelf::new(&hostname, "192.168.0.1011:12201")
        .unwrap()
        .fuse();
    let drain = slog_async::Async::new(drain).build().fuse();
    let log = slog::Logger::root(drain, o!("key" => "value"));

    info!(log,
        "An example log message";
        "k1" => "v1",
        "k2" => "v2",
    );
}

Commit count: 26

cargo fmt