async logger holder
This commit is contained in:
parent
ccffa14450
commit
1e120eef18
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -4148,9 +4148,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
@ -41,7 +41,7 @@ rubato = { version = "0.12", optional = true }
|
||||
samplerate = { version = "0.2", optional = true }
|
||||
async-trait = "0.1"
|
||||
crc32fast = "1.3"
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
uuid = { version = "1.0.0", features = ["v4"] }
|
||||
clap = "3.0"
|
||||
rpassword = "6.0"
|
||||
base64 = "0.13"
|
||||
|
28
src/main.rs
28
src/main.rs
@ -16,6 +16,8 @@ fn main() {
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios", feature = "cli")))]
|
||||
fn main() {
|
||||
// https://docs.rs/flexi_logger/latest/flexi_logger/error_info/index.html#write
|
||||
let mut _async_logger_holder: Option<flexi_logger::LoggerHandle> = None;
|
||||
let mut args = Vec::new();
|
||||
let mut i = 0;
|
||||
for arg in std::env::args() {
|
||||
@ -43,19 +45,19 @@ fn main() {
|
||||
}
|
||||
}
|
||||
use flexi_logger::*;
|
||||
Logger::try_with_env_or_str("debug")
|
||||
.map(|x| {
|
||||
x.log_to_file(FileSpec::default().directory(path))
|
||||
.format(opt_format)
|
||||
.rotate(
|
||||
Criterion::Age(Age::Day),
|
||||
Naming::Timestamps,
|
||||
Cleanup::KeepLogFiles(6),
|
||||
)
|
||||
.start()
|
||||
.ok();
|
||||
})
|
||||
.ok();
|
||||
if let Ok(x) = Logger::try_with_env_or_str("debug") {
|
||||
_async_logger_holder = x
|
||||
.log_to_file(FileSpec::default().directory(path))
|
||||
.write_mode(WriteMode::Async)
|
||||
.format(opt_format)
|
||||
.rotate(
|
||||
Criterion::Age(Age::Day),
|
||||
Naming::Timestamps,
|
||||
Cleanup::KeepLogFiles(6),
|
||||
)
|
||||
.start()
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
if args.is_empty() {
|
||||
std::thread::spawn(move || start_server(false, false));
|
||||
|
Loading…
x
Reference in New Issue
Block a user