You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* adjust the default format
* remove FromStr impl for Color
* note the stability of default format
* make shim termcolor cargo test friendly
* catch attempts to re-use builders
Copy file name to clipboardExpand all lines: README.md
+14-8
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ environment variable that corresponds with the log messages you want to show.
40
40
41
41
```bash
42
42
$ RUST_LOG=info ./main
43
-
INFO: 2017-11-09T02:12:24Z: main: starting up
43
+
[2018-11-03T06:09:06Z INFO default] starting up
44
44
```
45
45
46
46
### In tests
@@ -52,7 +52,7 @@ Tests can use the `env_logger` crate to see log messages generated during that t
52
52
log = "0.4.0"
53
53
54
54
[dev-dependencies]
55
-
env_logger = "0.5.13"
55
+
env_logger = { version = "0.5.13", default-features = false }
56
56
```
57
57
58
58
```rust
@@ -93,11 +93,11 @@ $ RUST_LOG=my_lib=info cargo test
93
93
Running target/debug/my_lib-...
94
94
95
95
running 2 tests
96
-
INFO: 2017-11-09T02:12:24Z: my_lib::tests: logging from another test
97
-
INFO: 2017-11-09T02:12:24Z: my_lib: add_one called with -8
96
+
[2017-11-09T02:12:24Z INFO my_lib::tests] logging from another test
97
+
[2017-11-09T02:12:24Z INFO my_lib] add_one called with -8
98
98
test tests::it_handles_negative_numbers ... ok
99
-
INFO: 2017-11-09T02:12:24Z: my_lib::tests: can log from the test too
100
-
INFO: 2017-11-09T02:12:24Z: my_lib: add_one called with 2
99
+
[2017-11-09T02:12:24Z INFO my_lib::tests] can log from the test too
100
+
[2017-11-09T02:12:24Z INFO my_lib] add_one called with 2
101
101
test tests::it_adds_one ... ok
102
102
103
103
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured
@@ -115,8 +115,8 @@ $ RUST_LOG=my_lib=info cargo test it_adds_one
115
115
Running target/debug/my_lib-...
116
116
117
117
running 1 test
118
-
INFO: 2017-11-09T02:12:24Z: my_lib::tests: can log from the test too
119
-
INFO: 2017-11-09T02:12:24Z: my_lib: add_one called with 2
118
+
[2017-11-09T02:12:24Z INFO my_lib::tests] can log from the test too
119
+
[2017-11-09T02:12:24Z INFO my_lib] add_one called with 2
120
120
test tests::it_adds_one ... ok
121
121
122
122
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
@@ -138,3 +138,9 @@ if env::var("RUST_LOG").is_ok() {
138
138
}
139
139
builder.init();
140
140
```
141
+
142
+
## Stability of the default format
143
+
144
+
The default format won't optimise for long-term stability, and explicitly makes no guarantees about the stability of its output across major, minor or patch version bumps during `0.x`.
145
+
146
+
If you want to capture or interpret the output of `env_logger` programmatically then you should use a custom format.
0 commit comments