Reopen log file on SIGHUP

This commit is contained in:
Tobias Bölz authored and Mathijs van Veluw committed 2023-10-21 17:14:03 +02:00
1 parent ff8db4fd78
commit 66a7baa67c
3 files changed
+26 -2

No files matched your search

+10 -1
View File
@@ -326,7 +326,16 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
}
if let Some(log_file) = CONFIG.log_file() {
logger = logger.chain(fern::log_file(log_file)?);
#[cfg(windows)]
{
logger = logger.chain(fern::log_file(log_file)?);
}
#[cfg(not(windows))]
{
const SIGHUP: i32 = 1;
let path = Path::new(&log_file);
logger = logger.chain(fern::log_reopen1(path, [SIGHUP])?);
}
}
#[cfg(not(windows))]