use thiserror::Error as ThisError;
#[derive(Debug, ThisError)]
#[non_exhaustive]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("logging is already initialized")]
AlreadyInitialized,
#[error("logging is not initialized")]
NotInitialized,
#[error("runtime filter reload was not enabled during init")]
ReloadNotEnabled,
#[error("the logging state lock is poisoned")]
LockPoisoned,
#[error("invalid filter directives for {0}")]
InvalidFilter(String),
#[error("Application Insights: {0}")]
AppInsights(String),
#[error("failed to install the global tracing subscriber: {0}")]
SetGlobalDefault(#[from] tracing::subscriber::SetGlobalDefaultError),
#[error("failed to reload the runtime filter: {0}")]
FilterReload(#[from] tracing_subscriber::reload::Error),
#[error("invalid filter directive: {0}")]
FilterParse(#[from] tracing_subscriber::filter::ParseError),
#[error("could not read logging settings: {0}")]
Settings(#[from] crate::config::Error),
#[error("invalid logging settings: {0}")]
InvalidSettings(String),
}