logging 0.1.0

logging inspired by the python logging fascility.
Documentation

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.