You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1KB

  1. #[macro_use] extern crate slog;
  2. extern crate logging;
  3. extern crate slog_term;
  4. use slog::*;
  5. use logging::warnings::ZmqDrain;
  6. use std::io::Write;
  7. use std::thread;
  8. use std::time::Duration;
  9. fn main() {
  10. //let term_decorator = slog_term::TermDecorator::new().build();
  11. //let term_drain = slog_term::CompactFormat::new(term_decorator).build().fuse();
  12. let plain = slog_term::PlainSyncDecorator::new(std::io::stdout());
  13. let plain_fuse = slog_term::FullFormat::new(plain).build().fuse();
  14. let w = logging::warnings::WarningsManager::new("test");
  15. let w_drain = logging::warnings::WarningsDrain::new(w.tx.clone(), Level::Debug, plain_fuse);
  16. //let zmq_drain = ZmqDrain::new(plain_fuse);
  17. //let zmq_decorator = slog_term::PlainSyncDecorator::new(zmq_drain);
  18. //let zmq_fuse = slog_term::FullFormat::new(zmq_decorator).build().fuse();
  19. let logger = Logger::root(w_drain, o!());
  20. //let logger =
  21. // Logger::root(Duplicate::new(plain_fuse, zmq_fuse).fuse(), o!());
  22. let mut i = 0;
  23. loop {
  24. info!(logger, "hello world";
  25. "i" => i);
  26. i += 1;
  27. thread::sleep(Duration::from_secs(1));
  28. }
  29. }