mirror of
https://github.com/JakeStanger/ironbar.git
synced 2024-11-29 21:16:00 +03:00
refactor(logging): consts for default log levels
This commit is contained in:
parent
51d1cd4a16
commit
5ebc84c7b9
@ -31,12 +31,15 @@ impl<'a> MakeWriter<'a> for MakeFileWriter {
|
|||||||
/// The returned `WorkerGuard` must remain in scope
|
/// The returned `WorkerGuard` must remain in scope
|
||||||
/// for the lifetime of the application for logging to file to work.
|
/// for the lifetime of the application for logging to file to work.
|
||||||
pub fn install_tracing() -> Result<WorkerGuard> {
|
pub fn install_tracing() -> Result<WorkerGuard> {
|
||||||
|
const DEFAULT_LOG: &str = "info";
|
||||||
|
const DEFAULT_FILE_LOG: &str = "warn";
|
||||||
|
|
||||||
let fmt_layer = fmt::layer().with_target(true);
|
let fmt_layer = fmt::layer().with_target(true);
|
||||||
let filter_layer =
|
let filter_layer =
|
||||||
EnvFilter::try_from_env("IRONBAR_LOG").or_else(|_| EnvFilter::try_new("info"))?;
|
EnvFilter::try_from_env("IRONBAR_LOG").or_else(|_| EnvFilter::try_new(DEFAULT_LOG))?;
|
||||||
|
|
||||||
let file_filter_layer =
|
let file_filter_layer = EnvFilter::try_from_env("IRONBAR_FILE_LOG")
|
||||||
EnvFilter::try_from_env("IRONBAR_FILE_LOG").or_else(|_| EnvFilter::try_new("warn"))?;
|
.or_else(|_| EnvFilter::try_new(DEFAULT_FILE_LOG))?;
|
||||||
|
|
||||||
let log_path = data_dir().unwrap_or(env::current_dir()?).join("ironbar");
|
let log_path = data_dir().unwrap_or(env::current_dir()?).join("ironbar");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user