LogarchiveProvider

Struct LogarchiveProvider 

Source
pub struct LogarchiveProvider { /* private fields */ }
Expand description

Provides an implementation of FileProvider that enumerates the required files at the correct paths on a from a provided logarchive.

§Example

   use macos_unifiedlogs::filesystem::LogarchiveProvider;
   use std::path::PathBuf;

   let mut test_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
   test_path.push("tests/test_data/system_logs_big_sur.logarchive");
   let provider = LogarchiveProvider::new(test_path.as_path());

Implementations§

Source§

impl LogarchiveProvider

Source

pub fn new(path: &Path) -> Self

Trait Implementations§

Source§

impl FileProvider for LogarchiveProvider

Source§

fn tracev3_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provide iterator for tracev3 files

§Example
   use macos_unifiedlogs::filesystem::LogarchiveProvider;
   use macos_unifiedlogs::traits::FileProvider;
   use macos_unifiedlogs::parser::collect_timesync;
   use std::path::PathBuf;

   let mut test_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
   test_path.push("tests/test_data/system_logs_big_sur.logarchive");
   let provider = LogarchiveProvider::new(test_path.as_path());
   for mut entry in provider.tracev3_files() {
     println!("TraceV3 file: {}", entry.source_path());
   }
Source§

fn uuidtext_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of UUIDText string files from the /var/db/uuidtext/XX/ directories, where the XX is any two uppercase hex characters, along with the filename (i.e., the filename from the source file. This should be a 30-character name containing only hex digits. This should be a 30-character name containing only hex digits. It is important that this is. accurate, or else strings will not be able to be referenced from the source file.
Source§

fn read_uuidtext(&self, uuid: &str) -> Result<UUIDText, Error>

Reads a provided UUID file at runtime. The UUID is obtaind by parsing the tracev3 files. Reads will fail if the UUID does not exist This avoids having to read all UUIDText files into memory.
Source§

fn read_dsc_uuid(&self, uuid: &str) -> Result<SharedCacheStrings, Error>

Reads a provided UUID file at runtime. The UUID is obtaind by parsing the tracev3 files. Reads will fail if the UUID does not exist This avoids having to read all SharedCacheStrings files into memory.
Source§

fn cached_uuidtext(&self, uuid: &str) -> Option<&UUIDText>

Check our cached UUIDText data for strings
Source§

fn cached_dsc(&self, uuid: &str) -> Option<&SharedCacheStrings>

Check our cached SharedCacheStrings for strings
Source§

fn dsc_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of shared string files from the /var/db/uuidtext/dsc subdirectory, along with the filename (i.e., the filename from the source file). This should be a 30-character name containing only hex digits. It is important that this is. accurate, or else strings will not be able to be referenced from the source file.
Source§

fn update_uuid(&mut self, uuid: &str, uuid2: &str)

Update our cached UUIDText data
Source§

fn update_dsc(&mut self, uuid: &str, uuid2: &str)

Update our cached SharedCacheStrings data
Source§

fn timesync_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of .timesync files from the /var/db/diagnostics/timesync subdirectory.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.