use crate::log_specification::LogSpecification;
use thiserror::Error;
#[non_exhaustive]
#[derive(Error, Debug)]
pub enum FlexiLoggerError {
#[error("Chosen reset not possible")]
Reset,
#[error("Method not possible because duplication is not possible")]
NoDuplication,
#[error("Method not possible because no file logger is configured")]
NoFileLogger,
#[error("Log file cannot be written because the specified path is not a directory")]
OutputBadDirectory,
#[error("Log file cannot be written because the specified path is a directory")]
OutputBadFile,
#[error("Invalid input for deriving FileSpec")]
BadFileSpec(&'static str),
#[error("Spawning the cleanup thread failed.")]
OutputCleanupThread(std::io::Error),
#[error(
"Log cannot be written, e.g. because the configured output directory is not accessible"
)]
OutputIo(#[from] std::io::Error),
#[error("Parsing the configured logspec toml-file failed")]
#[cfg(feature = "specfile_without_notification")]
#[cfg_attr(docsrs, doc(cfg(feature = "specfile")))]
SpecfileToml(#[from] toml::de::Error),
#[error("Specfile cannot be accessed or created")]
#[cfg(feature = "specfile_without_notification")]
#[cfg_attr(docsrs, doc(cfg(feature = "specfile")))]
SpecfileIo(std::io::Error),
#[error("Specfile has an unsupported extension")]
#[cfg(feature = "specfile_without_notification")]
#[cfg_attr(docsrs, doc(cfg(feature = "specfile")))]
SpecfileExtension(&'static str),
#[error("Invalid level filter")]
LevelFilter(String),
#[error("Failed to parse log specification: {0}")]
Parse(String, LogSpecification),
#[error("Logger initialization failed")]
Log(#[from] log::SetLoggerError),
#[error("Some synchronization object is poisoned")]
Poison,
#[cfg(feature = "colors")]
#[error("Palette parsing failed")]
Palette(#[from] std::num::ParseIntError),
#[cfg(feature = "colors")]
#[error("Repeated palette initialization failed")]
RepeatedPaletteInitialization,
#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
#[error("Logger is shut down")]
Shutdown(#[from] crossbeam_channel::SendError<Vec<u8>>),
#[cfg(feature = "trc")]
#[cfg_attr(docsrs, doc(cfg(feature = "trc")))]
#[error("Tracing initialization failed")]
TracingSetup(#[from] tracing::subscriber::SetGlobalDefaultError),
}
impl From<std::convert::Infallible> for FlexiLoggerError {
fn from(_other: std::convert::Infallible) -> FlexiLoggerError {
unreachable!("lkjl,mnkjiu")
}
}