tiny_tracing/errors.rs
1use thiserror::Error;
2
3/// Errors that can occur when configuring and initialising the logger.
4#[derive(Error, Debug, PartialEq, Eq)]
5pub enum LoggerError {
6 /// The supplied format string is not a known [`LogFormat`](crate::LogFormat).
7 ///
8 /// Returned by `LogFormat::from_str`, not by `Logger::init` — the builder
9 /// itself is typed, so this cannot occur when values are passed as enums.
10 #[error("Invalid log format: '{0}'. Valid formats are: 'text', 'json'.")]
11 InvalidFormat(String),
12 /// The env filter string could not be parsed by
13 /// [`EnvFilter`](tracing_subscriber::EnvFilter).
14 #[error("Invalid env filter: '{0}'.")]
15 InvalidEnvFilter(String),
16 /// A global tracing subscriber is already set (double-init).
17 #[error("Failed to initialize subscriber: {0}")]
18 TryInitError(String),
19}