Skip to content

Commit d2407a1

Browse files
committed
update
1 parent 4d542a2 commit d2407a1

File tree

3 files changed

+56
-9
lines changed

3 files changed

+56
-9
lines changed

Cargo.lock

Lines changed: 44 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ edition = "2018"
1010
clap = { git = "https://github.com/clap-rs/clap/" }
1111
mio = "0.6"
1212
log = "0.4"
13-
fern = "0.5"
1413
chrono = "0.4"
1514
libc = "0.2"
1615
rustls = "0.17"
@@ -22,3 +21,7 @@ webpki-roots = "0.19"
2221
webpki = "0.21"
2322
mio-extras = "2.0"
2423
socket2 = "0.3"
24+
25+
[dependencies.fern]
26+
version = "0.6"
27+
features = ["reopen-03"]

src/config.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,14 @@ pub fn setup_logger(logfile: &Option<String>, level: u8) {
197197
})
198198
.level(level);
199199
if logfile.is_some() {
200-
builder = builder.chain(fern::log_file(logfile.as_ref().unwrap()).unwrap());
200+
cfg_if::cfg_if!{
201+
if #[cfg(unix)] {
202+
let path = std::path::Path::new(logfile.as_ref().unwrap().as_str());
203+
builder = builder.chain(fern::log_reopen(path, Some(libc::SIGUSR2)).unwrap());
204+
} else {
205+
builder = builder.chain(fern::log_file(logfile.as_ref().unwrap()).unwrap());
206+
}
207+
}
201208
} else {
202209
builder = builder.chain(std::io::stdout());
203210
}

0 commit comments

Comments
 (0)