pub struct StdoutClient { /* private fields */ }Implementations§
Source§impl StdoutClient
impl StdoutClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new StdoutClient with the default writer (stdout).
§Example
use otlp_stdout_client::StdoutClient;
let client = StdoutClient::new();Sourcepub fn new_with_writer<W>(writer: W) -> Self
pub fn new_with_writer<W>(writer: W) -> Self
Creates a new StdoutClient with a custom writer.
This method allows you to specify an alternative writer, such as a file or an in-memory buffer.
§Arguments
writer- Any writer implementingAsyncWrite + Send + Sync + Unpin + 'static.
§Example
use otlp_stdout_client::StdoutClient;
use tokio::fs::File;
// Using a file as the writer
let file = File::create("output.log").await?;
let client = StdoutClient::new_with_writer(file);Trait Implementations§
Source§impl Debug for StdoutClient
impl Debug for StdoutClient
Source§impl Default for StdoutClient
impl Default for StdoutClient
Source§impl HttpClient for StdoutClient
Implements the HttpClient trait for StdoutClient.
impl HttpClient for StdoutClient
Implements the HttpClient trait for StdoutClient.
This implementation allows the StdoutClient to be used as an HTTP client
for sending OTLP (OpenTelemetry Protocol) data. It processes the request body
and writes it to stdout in a JSON format suitable for log parsing.
The send method handles both JSON and non-JSON payloads, formatting them
appropriately for stdout output.
Source§fn send_bytes<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_bytes<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send the specified HTTP request with
Bytes payload. Read moreSource§fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
👎Deprecated: Use
send_bytes with Bytes payload instead.Send the specified HTTP request with
Vec<u8> payload Read moreAuto Trait Implementations§
impl Freeze for StdoutClient
impl !RefUnwindSafe for StdoutClient
impl Send for StdoutClient
impl Sync for StdoutClient
impl Unpin for StdoutClient
impl !UnwindSafe for StdoutClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more