ndjsonlogger 0.1.0

ndjsonlogger
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 28.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 341.88 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • flickpp/ndjsonlogger
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • flickpp

ndjsonlogger

ndjsonlogger is an nd (newline delimited) json logger.

Rust 1.60 or greater is required.

TODO/Features

  • debug, info, warn and error macros
  • debug! macro compiles to no-op on release builds
  • trace macro with trace mask
  • all JSON primative types (number, bool, null) supported
  • one level of nested arrays
  • Option<&[_]> and &[Option<_>]
  • compile-time iso timestamp feature
  • quickstart print log lines to stdout
  • configurable alternative sinks for log lines
  • initialize with service name - add to all log lines
  • custom runtime logic for additional key/value(s)
  • work with ndjsonloggercore no_std

Quickstart

[dependencies]
ndjsonlogger = "0.1"
ndjsonloggercore = {version = "0.1", features = ["std"]}

NOTE: You must include BOTH lines in your Cargo.toml. Additionally for the 0.1 release, the std feature is required in ndjsonloggercore.

use ndjsonlogger::{info, debug};

fn main() {
    info!("hello I'm a log line");

    debug!("application closing", {
        reason = "end of main function"
    });
}}
{"level": "info", "msg": "hello I'm a log line"}
{"level": "debug", "msg": "application closing", "reason": "end of main function"}

An example demonstrating all features is here.

Contributing

Contributions welcome. Please open a github issue.