logging 0.1.0

logging inspired by the python logging fascility.
Documentation
  • Coverage
  • 91.43%
    32 out of 35 items documented3 out of 27 items with examples
  • Size
  • Source code size: 14.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.41 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • void-dragon

logging

A logging fascility inspired by the python logging framework.

This library implements named herachical loggers which have message handlers associated with them.

usage

extern crate logging;

use std::sync::Arc;

struct MyOwnHandler {}

impl logging::Handler for MyOwnHandler {
  fn emit(&self, msg: &logging::Message) {
    print!("{:7} | {}", msg.name, msg.msg);
  }
}

fn main() {
  logging::debug("app started");

  let log = logging::get("myapp");
  log.add_handler(logging::ConsoleHandler::new());
  log.add_handler(Arc::new(Box::new(MyOwnHandler {})));

  log.info("created".to_owned());
  {
    let sub_log = logging::get("myapp.special");
    sub_log.debug("some other stuff");
  }
}

TODO

  • Add support for yaml configuration files.
  • Rotating file handler.