use thiserror::Error;
#[derive(Debug, Error)]
pub enum Logger2Error {
#[error("invalid hex color '{0}': expected format #RRGGBB or #RGB")]
InvalidColor(String),
#[error("invalid priority '{0}': expected 'facility.level' (e.g. user.notice)")]
InvalidPriority(String),
#[error("unknown facility '{0}'")]
UnknownFacility(String),
#[error("unknown severity/level '{0}'")]
UnknownLevel(String),
#[error("invalid key=value pair '{0}'")]
InvalidKeyValue(String),
#[error("message too large: {0} bytes (max {1})")]
MessageTooLarge(usize, usize),
#[error("no message provided (pass a message argument, --file, or pipe to stdin)")]
NoMessage,
#[error("config error: {0}")]
Config(String),
#[error("local syslog is not supported on this platform: {0}")]
UnsupportedPlatform(String),
#[error("network error while sending to {0}: {1}")]
Network(String, std::io::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
Toml(#[from] toml::de::Error),
#[error(transparent)]
TomlSer(#[from] toml::ser::Error),
#[error(transparent)]
Json(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, Logger2Error>;