mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 09:31:00 +00:00
[syslog] warning when syslog support is not enabled
This commit is contained in:
parent
091e693670
commit
84018be862
1 changed files with 26 additions and 19 deletions
|
@ -175,10 +175,11 @@ fn init_logging(opt: &Opt) {
|
||||||
|
|
||||||
let env_filter = tracing_subscriber::filter::EnvFilter::from_default_env();
|
let env_filter = tracing_subscriber::filter::EnvFilter::from_default_env();
|
||||||
|
|
||||||
#[cfg(feature = "syslog")]
|
|
||||||
if std::env::var("GARAGE_LOG_TO_SYSLOG")
|
if std::env::var("GARAGE_LOG_TO_SYSLOG")
|
||||||
.map(|x| x == "1" || x == "true")
|
.map(|x| x == "1" || x == "true")
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
#[cfg(feature = "syslog")]
|
||||||
{
|
{
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use syslog_tracing::{Facility, Options, Syslog};
|
use syslog_tracing::{Facility, Options, Syslog};
|
||||||
|
@ -202,6 +203,12 @@ fn init_logging(opt: &Opt) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#[cfg(not(feature = "syslog"))]
|
||||||
|
{
|
||||||
|
eprintln!("Syslog support is not enabled in this build.");
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
.with_writer(std::io::stderr)
|
.with_writer(std::io::stderr)
|
||||||
|
|
Loading…
Reference in a new issue