tweak color env variable options

As noted in mylog's 2b1085c:
Looks like both the GNU tools' --color argument and cargo's
CARGO_TERM_COLOR expect always/never rather than on/off. Match that.
Might as well understand off/no/false and on/yes/true also.
This commit is contained in:
Scott Lamb 2021-03-12 09:24:20 -08:00
parent 8ced3155e2
commit 1458d668d7
3 changed files with 7 additions and 6 deletions

View File

@ -3,6 +3,7 @@ on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
MOONFIRE_COLOR: always
RUST_BACKTRACE: 1
jobs:

View File

@ -46,8 +46,8 @@ Logging options are controlled by environment variables:
[glog](https://github.com/google/glog) package) and `google-systemd` (a
variation for better systemd compatibility).
* `MOONFIRE_COLOR` controls color coding when using the `google` format.
It accepts `on`, `off`, or `auto`. `auto` means to color code if stderr
is a terminal.
It accepts `always`, `never`, or `auto`. `auto` means to color code if
stderr is a terminal.
* Errors include a backtrace if `RUST_BACKTRACE=1` is set.
If you use Docker, set these via Docker's `--env` argument.
@ -59,8 +59,8 @@ format:
I20210308 21:31:24.255 main moonfire_nvr] Success.
LYYYYmmdd HH:MM:SS.FFF TTTT PPPPPPPPPPPP] ...
L = level:
E = error
W = warn
E = error; when color mode is on, the message will be bright red.
W = warn; " " " " " " " " " " yellow.
I = info
D = debug
T = trace
@ -72,7 +72,7 @@ MM = minute
SS = second
FFF = fractional portion of the second
TTTT = thread name (if set) or tid (otherwise)
PPPP = module path
PPPP = log target (usually a module path)
... = message body
```

2
server/Cargo.lock generated
View File

@ -1274,7 +1274,7 @@ dependencies = [
[[package]]
name = "mylog"
version = "0.1.0"
source = "git+https://github.com/scottlamb/mylog#1406a8d794d799971e0e1079d5188d2dc339c584"
source = "git+https://github.com/scottlamb/mylog#2b1085cfb3bd0b1f2afe7d8085045d81858c0050"
dependencies = [
"chrono",
"libc",