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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*!
## filtering
Use the ENV variable `RUST_LOG` with `module_name=level`
`RUST_LOG="tokio=warn,my_module=info,my_module::inner=trace"`
A default level can be provided with just ***level***. e.g. `RUST_LOG=trace` will enable `trace` for all modules.
You can disable specific modules/crates by using the `off` level
## optional features
* `time` allows formatting a UTC timestamp with the [`time`](time) crate.
* see the formatting description [here](https://time-rs.github.io/book/api/format-description.html)
[time]: https://docs.rs/time
*/
doctest!;
pub use Color;
/// Initialize the logger
///
/// ```rust
/// use alto_logger::{
/// options::{ColorConfig, StyleConfig, TimeConfig},
/// Options,
/// TermLogger,
/// };
/// alto_logger::init(
/// TermLogger::new(
/// Options::default()
/// .with_style(StyleConfig::SingleLine) // Default is a MultiLine output
/// .with_time(TimeConfig::relative_now()) // Default is no timestamp
/// .with_color(ColorConfig::only_levels()), // Default is full color
/// )
/// .unwrap(),
/// )
/// .unwrap()
/// ```
///
/// And using the shorthands
/// ```rust,ignore
/// use alto_logger::*;
///
/// // statically parse a format description
/// let fmt = time::macros::format_description!("[hour]:[minute]:[second]");
///
/// MultiLogger::new()
/// .with(TermLogger::default())
/// // date_time_format requires the `time` feature
/// .with(FileLogger::append(TimeConfig::date_time_format(format), "output.log").unwrap())
/// .init()
/// .expect("init logger");
/// ```
///
/// Convenience function to create a default terminal logger
///
/// This defaults to using:
/// * no timestamp
/// * default colors
/// * multi-line output
/// Convenience function to create a terminal logger that uses a single-line output, and unix timestamps.
pub use *;
pub use *;
pub use Error;