aws_lambda_log_proxy/
processor.rs

1mod builder;
2mod mock;
3mod simple;
4mod sink;
5
6use chrono::{DateTime, Utc};
7use std::future::Future;
8
9pub use builder::*;
10pub use simple::*;
11pub use sink::*;
12
13pub type Timestamp = DateTime<Utc>;
14
15pub trait Processor: Send + 'static {
16  /// Process a log line. The line is guaranteed to be non-empty and does not contain a newline character.
17  ///
18  /// The line may be an [EMF](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html) line.
19  /// You can use the [`is_emf`](crate::is_emf) util function to check if it is.
20  fn process(&mut self, line: String, timestamp: Timestamp) -> impl Future<Output = ()> + Send;
21
22  /// Flushes the underlying output stream, ensuring that all intermediately buffered contents reach their destination.
23  /// This method is called when the current invocation is about to end (the proxy got the request of `invocation/next`).
24  fn truncate(&mut self) -> impl Future<Output = ()> + Send;
25}