File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -28,44 +28,44 @@ fn main() {
28
28
29
29
This outputs:
30
30
31
- ```
31
+ ``` txt
32
32
2022-01-19T17:27:07.013874956Z WARN [logging_example] This is an example message.
33
33
```
34
34
35
35
You can run the above example with:
36
36
37
- ``` bash
37
+ ``` sh
38
38
cargo run --example init
39
39
```
40
40
41
41
Coloured output and timestamps will be enabled by default. You can remove these
42
42
features and their respective dependencies by disabling all features in your
43
43
` Cargo.toml ` .
44
44
45
- ```
45
+ ``` toml
46
46
[dependencies .simple_logger ]
47
47
default-features = false
48
48
```
49
49
50
50
To include the ` timestamps ` feature, but not the ` colors ` feature:
51
51
52
- ```
52
+ ``` toml
53
53
[dependencies .simple_logger ]
54
54
default-features = false
55
55
features = [" timestamps" ]
56
56
```
57
57
58
58
To include the ` colors ` feature, but not the ` timestamps ` feature:
59
59
60
- ```
60
+ ``` toml
61
61
[dependencies .simple_logger ]
62
62
default-features = false
63
63
features = [" colors" ]
64
64
```
65
65
66
66
To direct logging output to ` stderr ` use the ` stderr ` feature:
67
67
68
- ```
68
+ ``` toml
69
69
[dependencies .simple_logger ]
70
70
features = [" stderr" ]
71
71
```
Original file line number Diff line number Diff line change 2
2
//!
3
3
//! Optional features include timestamps, colored output and logging to stderr.
4
4
//!
5
- //! ```
5
+ //! ```rust
6
6
//! simple_logger::SimpleLogger::new().env().init().unwrap();
7
7
//!
8
8
//! log::warn!("This is an example message.");
12
12
//!
13
13
//! Just initialize logging without any configuration:
14
14
//!
15
- //! ```
15
+ //! ```rust
16
16
//! simple_logger::init().unwrap();
17
17
//! ```
18
18
//!
19
19
//! Set the log level from the `RUST_LOG` environment variable:
20
20
//!
21
- //! ```
21
+ //! ```rust
22
22
//! simple_logger::init_with_env().unwrap();
23
23
//! ```
24
24
//!
25
25
//! Hardcode a default log level:
26
26
//!
27
- //! ```
27
+ //! ```rust
28
28
//! simple_logger::init_with_level(log::Level::Warn).unwrap();
29
29
//! ```
30
30
@@ -488,15 +488,15 @@ fn set_up_color_terminal() {
488
488
}
489
489
}
490
490
491
- /// Initialise the logger with it's default configuration.
491
+ /// Initialise the logger with its default configuration.
492
492
///
493
493
/// Log messages will not be filtered.
494
494
/// The `RUST_LOG` environment variable is not used.
495
495
pub fn init ( ) -> Result < ( ) , SetLoggerError > {
496
496
SimpleLogger :: new ( ) . init ( )
497
497
}
498
498
499
- /// Initialise the logger with it's default configuration.
499
+ /// Initialise the logger with its default configuration.
500
500
///
501
501
/// Log messages will not be filtered.
502
502
/// The `RUST_LOG` environment variable is not used.
You can’t perform that action at this time.
0 commit comments