Struct datadog_logs::logger::DataDogLogger [−][src]
Logger that logs directly to DataDog via HTTP(S)
Implementations
impl DataDogLogger
[src]
pub fn selflog(&self) -> &Option<Receiver<String>>
[src]
Exposes self log of the logger.
Contains diagnostic messages with details of errors occuring inside logger.
It will be None
, unless enable_self_log
in DataDogConfig
is set to true
.
pub fn blocking<T>(client: T, config: DataDogConfig) -> Self where
T: DataDogClient + Send + 'static,
[src]
T: DataDogClient + Send + 'static,
Creates new blocking DataDogLogger instance
What it means is that no executor is used to host DataDog network client. A new thread is started instead.
It receives messages to log and sends them in batches in blocking fashion.
As this is a separate thread, calling log
does not imply any IO operation, thus is quite fast.
Examples
use datadog_logs::{config::DataDogConfig, logger::DataDogLogger, client::HttpDataDogClient}; let config = DataDogConfig::default(); let client = HttpDataDogClient::new(&config).unwrap(); let logger = DataDogLogger::blocking(client, config);
pub fn log<T: Display>(&self, message: T, level: DataDogLogLevel)
[src]
Sends log to DataDog thread or task.
This function does not invoke any IO operation by itself. Instead it sends messages to logger thread or task using channels. Therefore it is quite lightweight.
Examples
use datadog_logs::{config::DataDogConfig, logger::{DataDogLogger, DataDogLogLevel}, client::HttpDataDogClient}; let config = DataDogConfig::default(); let client = HttpDataDogClient::new(&config).unwrap(); let logger = DataDogLogger::blocking(client, config); logger.log("message", DataDogLogLevel::Error);
pub fn set_blocking_logger<T>(
client: T,
config: DataDogConfig,
level: LevelFilter
) -> Result<(), DataDogLoggerError> where
T: DataDogClient + Send + 'static,
[src]
client: T,
config: DataDogConfig,
level: LevelFilter
) -> Result<(), DataDogLoggerError> where
T: DataDogClient + Send + 'static,
Initializes blocking DataDogLogger with log
crate.
Examples
use datadog_logs::{config::DataDogConfig, logger::{DataDogLogger, DataDogLogLevel}, client::HttpDataDogClient}; use log::*; let config = DataDogConfig::default(); let client = HttpDataDogClient::new(&config).unwrap(); DataDogLogger::set_blocking_logger(client, config, LevelFilter::Error); error!("An error occured"); warn!("A warning")
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for DataDogLogger
[src]
impl Send for DataDogLogger
[src]
impl Sync for DataDogLogger
[src]
impl Unpin for DataDogLogger
[src]
impl !UnwindSafe for DataDogLogger
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,