timber_rust/service/aws/message.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Dante Doménech Martinez dante19031999@gmail.com
3
4#![cfg(feature = "aws")]
5#![cfg_attr(docsrs, doc(cfg(feature = "aws")))]
6
7/// A container for a log message and its associated CloudWatch metadata.
8///
9/// This struct pairs a generic [`crate::Message`] with a Unix timestamp (in milliseconds).
10/// By capturing the timestamp at the moment of creation, the logger ensures that
11/// events remain chronologically sortable even when buffered or processed
12/// asynchronously across multiple threads.
13///
14/// # CloudWatch Requirements
15/// CloudWatch Logs requires events within a single `PutLogEvents` batch to be
16/// sorted by timestamp in ascending order. While timestamps may be identical for
17/// high-frequency logs, the order of entries in the transmission determines
18/// their display sequence.
19pub struct Message {
20 /// The original log content, including its level and payload.
21 pub message: crate::Message,
22 /// The Unix epoch timestamp in milliseconds.
23 ///
24 /// Represented as an [`i64`] to comply with the AWS SDK requirements.
25 pub timestamp: i64,
26}