1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::convert::From;
use std::fmt::Display;
#[derive(Debug)]
pub enum DataDogLoggerError {
UrlParsingError(url::ParseError),
#[cfg(feature = "log-integration")]
LogIntegrationError(log::SetLoggerError)
}
impl Display for DataDogLoggerError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
DataDogLoggerError::UrlParsingError(e) => write!(f, "{}", e),
#[cfg(feature = "log-integration")]
DataDogLoggerError::LogIntegrationError(e) => write!(f, "{}", e)
}
}
}
impl From<url::ParseError> for DataDogLoggerError {
fn from(e: url::ParseError) -> Self {
DataDogLoggerError::UrlParsingError(e)
}
}
#[cfg(feature = "log-integration")]
impl From<log::SetLoggerError> for DataDogLoggerError {
fn from(e: log::SetLoggerError) -> Self {
DataDogLoggerError::LogIntegrationError(e)
}
}