Skip to main content

LogReader

Struct LogReader 

Source
pub struct LogReader { /* private fields */ }

Implementations§

Source§

impl LogReader

Source

pub fn open<P: AsRef<Path>>(path: P) -> Self

Create a log reader for the file at the specified path.

The file is opened when iteration begins. If the file does not exist or is not readable, the first iteration will return an error.

Source

pub fn system() -> Self

Create a log reader for the system pacman log at /var/log/pacman.log.

Source

pub fn reverse(self) -> Self

Read entries in reverse order (most recent first).

Source

pub fn filter_action(self, action: Action) -> Self

Filter entries by action type.

Source

pub fn filter_package(self, package: &str) -> Self

Filter entries by package name (substring match).

Source

pub fn filter_package_exact(self, package: &str) -> Self

Filter entries by exact package name.

Source

pub fn since(self, timestamp: DateTime<FixedOffset>) -> Self

Filter entries since the given timestamp (inclusive).

Source

pub fn until(self, timestamp: DateTime<FixedOffset>) -> Self

Filter entries until the given timestamp (inclusive).

Source

pub fn entries(self) -> impl Iterator<Item = Result<Entry>>

Iterate over every log line as an Entry, in forward order.

Unlike the IntoIterator impl, this yields all line types (commands, transaction markers, hook and scriptlet output) and ignores the filters.

Source

pub fn transactions(self) -> impl Iterator<Item = Result<Transaction>>

Group package operations into transactions, in forward order.

Each Transaction is delimited by the transaction started and transaction completed markers and tagged with the most recent pacman command logged before it. A transaction left open by a truncated log is still yielded, with completed set to None.

Trait Implementations§

Source§

impl IntoIterator for LogReader

Source§

type Item = Result<LogEntry, Error>

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = Result<LogEntry, Error>>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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.