1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-05-29 23:13:57 +00:00

With the latest fern, syslog can be a config option instead of a build flag

This commit is contained in:
Daniel García 2019-03-29 20:27:20 +01:00
parent d9406b0095
commit c5832f2b30
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
4 changed files with 64 additions and 61 deletions

View file

@ -275,6 +275,8 @@ make_config! {
log_mounts: bool, true, def, false;
/// Enable extended logging
extended_logging: bool, false, def, true;
/// Enable the log to output to Syslog
use_syslog: bool, false, def, false;
/// Log file path
log_file: String, false, option;
/// Log level

View file

@ -90,19 +90,19 @@ fn init_logging() -> Result<(), fern::InitError> {
if let Some(log_file) = CONFIG.log_file() {
logger = logger.chain(fern::log_file(log_file)?);
}
#[cfg(not(windows))] {
if cfg!(feature="enable_syslog") || CONFIG.use_syslog() {
logger = chain_syslog(logger);
}
}
logger = chain_syslog(logger);
logger.apply()?;
Ok(())
}
#[cfg(not(feature = "enable_syslog"))]
fn chain_syslog(logger: fern::Dispatch) -> fern::Dispatch {
logger
}
#[cfg(feature = "enable_syslog")]
#[cfg(not(windows))]
fn chain_syslog(logger: fern::Dispatch) -> fern::Dispatch {
let syslog_fmt = syslog::Formatter3164 {
facility: syslog::Facility::LOG_USER,