pub struct LogProxy<P> {
pub processor: P,
pub buffer_size: usize,
pub port: u16,
}Expand description
§Examples
Simple creation:
use aws_lambda_log_proxy::{LogProxy, Sink};
LogProxy::new().simple(|p| p.sink(Sink::stdout().spawn()).build()).start().await;Custom creation:
use aws_lambda_log_proxy::{LogProxy, Processor, Timestamp};
pub struct MyProcessor;
impl Processor for MyProcessor {
async fn process(&mut self, _line: String, _timestamp: Timestamp) { }
async fn truncate(&mut self) { }
}
LogProxy::new().processor(MyProcessor).buffer_size(1024).port(1234).start().await;Fields§
§processor: PThe processor for stdin.
buffer_size: usizeSee Self::buffer_size.
port: u16See Self::port.
Implementations§
Source§impl<P> LogProxy<P>
impl<P> LogProxy<P>
Sourcepub fn processor<T>(self, processor: T) -> LogProxy<T>
pub fn processor<T>(self, processor: T) -> LogProxy<T>
Set Self::processor to a custom processor.
Sourcepub fn simple<T>(
self,
builder: impl FnOnce(SimpleProcessorBuilder<fn(String) -> Option<String>, ()>) -> SimpleProcessor<T>,
) -> LogProxy<SimpleProcessor<T>>
pub fn simple<T>( self, builder: impl FnOnce(SimpleProcessorBuilder<fn(String) -> Option<String>, ()>) -> SimpleProcessor<T>, ) -> LogProxy<SimpleProcessor<T>>
Set Self::processor to a SimpleProcessor via SimpleProcessorBuilder.
§Examples
use aws_lambda_log_proxy::{LogProxy, Sink};
LogProxy::new().simple(|p| p.sink(Sink::stdout().spawn()).build());Sourcepub fn buffer_size(self, buffer_size: usize) -> Self
pub fn buffer_size(self, buffer_size: usize) -> Self
Set how many lines can be buffered if the processing is slow.
If the handler process writes too many lines then return the response immediately,
the suppression of invocation/next
might not working, maybe some logs will be processed in the next invocation.
Increase this value should help to prevent logs from being lost.
The default value is 256.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for LogProxy<P>where
P: Freeze,
impl<P> RefUnwindSafe for LogProxy<P>where
P: RefUnwindSafe,
impl<P> Send for LogProxy<P>where
P: Send,
impl<P> Sync for LogProxy<P>where
P: Sync,
impl<P> Unpin for LogProxy<P>where
P: Unpin,
impl<P> UnwindSafe for LogProxy<P>where
P: UnwindSafe,
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