pub struct Output { /* private fields */ }
Expand description
Represents the output buffer for log data before it’s sent to S3. Manages buffering, naming, and partitioning of log files.
Implementations§
Source§impl Output
impl Output
Sourcepub fn bump_part(&mut self)
pub fn bump_part(&mut self)
Increments the part number and updates the file name. Called when the current log file becomes too large and needs to be split.
Sourcepub fn gen_name(prefix: &str, part: u64, postfix: &str, nonce: &str) -> String
pub fn gen_name(prefix: &str, part: u64, postfix: &str, nonce: &str) -> String
Generates a log file name based on the current date, part number, and configuration.
§Arguments
prefix
- The file name prefixpart
- The part number for file splittingpostfix
- The file extension/postfixnonce
- A unique identifier for this logging session
§Returns
A formatted file name in the pattern: YYYY-MM-DD/part/prefix-nonce.postfix
Sourcepub async fn buffer_len(&self) -> u64
pub async fn buffer_len(&self) -> u64
Returns the number of log entries currently in the buffer.
Sourcepub async fn flush_buffer(&self) -> String
pub async fn flush_buffer(&self) -> String
Flushes the buffer and returns all buffered log entries as a single string. Clears the buffer and resets the size counter after flushing.
§Returns
A newline-delimited string containing all buffered log entries
Sourcepub async fn append_to_buffer(&self, value: String)
pub async fn append_to_buffer(&self, value: String)
Appends a log entry to the buffer and updates the size counter.
§Arguments
value
- The log entry to append to the buffer
Sourcepub fn size_in_bytes(&self) -> u64
pub fn size_in_bytes(&self) -> u64
Returns the current buffer size in bytes.
Sourcepub fn update_size_in_bytes(&self, size_in_bytes: u64)
pub fn update_size_in_bytes(&self, size_in_bytes: u64)
Sourcepub fn update_name(&mut self, name: &str)
pub fn update_name(&mut self, name: &str)
Auto Trait Implementations§
impl Freeze for Output
impl !RefUnwindSafe for Output
impl Send for Output
impl Sync for Output
impl Unpin for Output
impl !UnwindSafe for Output
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more