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.

37 lines
1.2KB

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