pub struct LogFileStats {
pub file_count: usize,
pub total_size_bytes: u64,
pub oldest_file_timestamp: Option<u64>,
pub newest_file_timestamp: Option<u64>,
}Expand description
Statistics about log files for a given directory.
Fields§
§file_count: usizeTotal number of log files.
total_size_bytes: u64Total size of all log files in bytes.
oldest_file_timestamp: Option<u64>Oldest file timestamp (Unix timestamp).
newest_file_timestamp: Option<u64>Newest file timestamp (Unix timestamp).
Implementations§
Source§impl LogFileStats
impl LogFileStats
Sourcepub fn from_directory(
directory: &Path,
filename_prefix: &str,
) -> Result<LogFileStats, Error>
pub fn from_directory( directory: &Path, filename_prefix: &str, ) -> Result<LogFileStats, Error>
Calculate statistics for log files in a directory.
Sourcepub fn total_size_human_readable(&self) -> String
pub fn total_size_human_readable(&self) -> String
Get total size in a human-readable format.
Sourcepub fn oldest_file_age_days(&self) -> Option<u32>
pub fn oldest_file_age_days(&self) -> Option<u32>
Get the age of the oldest file in days.
Trait Implementations§
Source§impl Clone for LogFileStats
impl Clone for LogFileStats
Source§fn clone(&self) -> LogFileStats
fn clone(&self) -> LogFileStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogFileStats
impl Debug for LogFileStats
Source§impl Default for LogFileStats
impl Default for LogFileStats
Source§fn default() -> LogFileStats
fn default() -> LogFileStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LogFileStats
impl RefUnwindSafe for LogFileStats
impl Send for LogFileStats
impl Sync for LogFileStats
impl Unpin for LogFileStats
impl UnsafeUnpin for LogFileStats
impl UnwindSafe for LogFileStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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