use std::io;
use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("could not create or write the log directory {path}: {source}")]
LogDir {
path: PathBuf,
source: io::Error,
},
#[error("could not open the rolling log file in {path}: {source}")]
Appender {
path: PathBuf,
source: tracing_appender::rolling::InitError,
},
#[error("invalid log filter directive {directive:?}: {message}")]
Filter {
directive: String,
message: String,
},
#[error("a tracing subscriber is already installed; dig_logging::init must be called once")]
AlreadyInitialized,
#[error(transparent)]
Io(#[from] io::Error),
#[error("could not serialize the bundle manifest: {0}")]
Manifest(#[from] serde_json::Error),
#[error("could not write the log bundle: {0}")]
Bundle(#[from] zip::result::ZipError),
}
pub type Result<T> = std::result::Result<T, Error>;