use thiserror::Error;
#[derive(Error, Debug, Clone)]
#[non_exhaustive]
pub enum LoggerError {
#[error("Could not parse log style. Log style should be auto | always | never")]
StyleParse,
#[error("I/O error: {0}")]
IOError(String),
#[error("Could not create logfile {0}")]
NoLogfile(String),
#[error("Error resolving platform-specific configuration: {0}")]
Platform(#[from] wick_xdg::Error),
#[error("Could not initialize logger: {0}")]
InitFailed(String),
}
impl From<std::io::Error> for LoggerError {
fn from(e: std::io::Error) -> Self {
LoggerError::IOError(e.to_string())
}
}
impl From<tracing::dispatcher::SetGlobalDefaultError> for LoggerError {
fn from(e: tracing::dispatcher::SetGlobalDefaultError) -> Self {
LoggerError::InitFailed(e.to_string())
}
}