1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Quil is a easy to use library that supports message levels, multiple
//! targets, and message contexts. Quil is thread safe and so it is possible
//! to send loggers accross threads.
//!
//! # Examples
//!
//! Basic example:
//!
//! ```rust
//! # #[macro_use] extern crate quil;
//! # fn main() {
//! # use quil::prelude::*;
//! let logger = Logger::new(Console::new(), context!{ src: "root" });
//!
//! logger.info("hello world");
//! # }
//! ```
//!
//! ```shell
//! Tue,  7 Nov 2017 23:55:42 +0000 - info:    hello world src=root
//! ```
//!
//! Sub-context example:
//!
//! ```rust
//! # #[macro_use] extern crate quil;
//! # fn main() {
//! # use quil::prelude::*;
//! let logger = Logger::new(Console::new(), context!{ src: "root", tag: "1" });
//! logger.info("hello");
//!
//! let sub_logger = logger.ctx(context!{ tag: "", marker: "49" });
//! logger.info("world");
//! # }
//! ```
//!
//! ```shell
//! Tue,  7 Nov 2017 23:55:42 +0000 - info:    hello src=root tag=1
//! Tue,  7 Nov 2017 23:55:42 +0000 - info:    world src=root marker=49
//! ```

extern crate chrono;
extern crate colored;

#[macro_use]
mod context;
mod level;
mod logger;

#[macro_use]
pub mod targets;

pub use targets::Target;
pub use context::Context;
pub use level::Level;
pub use logger::Logger;

/// A convenience module that can be used to include commonly used quil types.
///
/// # Examples
///
/// ```rust
/// use quil::prelude::*;
/// ```
pub mod prelude {
  pub use targets::{Console, JsonFile};
  pub use level::Level::*;
  pub use context::Context;
  pub use logger::Logger;
}