mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-09 13:39:46 -05:00
support color coding logs (#112)
ffmpeg was already doing this; now do it for native logs.
This commit is contained in:
3
server/Cargo.lock
generated
3
server/Cargo.lock
generated
@@ -1274,9 +1274,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "mylog"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scottlamb/mylog#64519c6d9d4587d803900b82a83b45b35939b8f7"
|
||||
source = "git+https://github.com/scottlamb/mylog#1406a8d794d799971e0e1079d5188d2dc339c584"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"libc",
|
||||
"log",
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This file is part of Moonfire NVR, a security camera network video recorder.
|
||||
// Copyright (C) 2020 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
||||
// Copyright (C) 2021 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
||||
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception.
|
||||
|
||||
#![cfg_attr(all(feature = "nightly", test), feature(test))]
|
||||
@@ -116,6 +116,12 @@ fn main() {
|
||||
.and_then(|s| mylog::Format::from_str(&s))
|
||||
.unwrap_or(mylog::Format::Google),
|
||||
)
|
||||
.set_color(
|
||||
::std::env::var("MOONFIRE_COLOR")
|
||||
.map_err(|_| ())
|
||||
.and_then(|s| mylog::ColorMode::from_str(&s))
|
||||
.unwrap_or(mylog::ColorMode::Auto),
|
||||
)
|
||||
.set_spec(&::std::env::var("MOONFIRE_LOG").unwrap_or("info".to_owned()))
|
||||
.build();
|
||||
h.clone().install().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user