Skip to content

slog-rs/html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slog-rs logo
Travis CI Build Status AppVeyor Build Status slog-html on crates.io slog-rs Gitter Chat slog-html documentation

slog-html - HTML format for slog-stream of slog-rs

Example

#[macro_use]
extern crate slog;
extern crate slog_html;
extern crate slog_stream;

use slog::DrainExt;

use std::fs::OpenOptions;

fn main() {
    let file = OpenOptions::new()
        .create(true)
        .write(true)
        .truncate(true)
        .open("target/log.html").unwrap();

    let log = slog::Logger::root(
        slog_stream::stream(
            file,
            slog_html::default()
        ).fuse(),
        o!("version" => env!("CARGO_PKG_VERSION"))
    );

    debug!(log, "debug values"; "x" => 1, "y" => -1);
}

Rendered example output

slog-rs html full-format output

Compact mode:

slog-rs html compact output

Full mode:

slog-rs html full output