pub struct LiveLogDirReader { /* private fields */ }
Available on crate feature
asynchronous
only.Expand description
The async variant of [super::blocking::LiveLogDirReader]. Watches the whole journal dir and reads all files. Once all historic files have been read the current read will only resolve once the newest log file is changed at which it will read the active log file and return the entry.
use std::path::PathBuf;
use ed_journals::logs::asynchronous::LiveLogDirReader;
let path = PathBuf::from("somePath");
let mut live_dir_reader = LiveLogDirReader::open(path)
.unwrap();
// At first this will read all existing lines from the journal logs, after which it will wait
// until it detects new entries in the latest log file.
while let Some(entry) = live_dir_reader.next().await {
// Do something with the entry
}
Implementations§
Source§impl LiveLogDirReader
impl LiveLogDirReader
pub fn open<P: AsRef<Path>>( dir_path: P, ) -> Result<LiveLogDirReader, LiveLogDirReaderError>
pub async fn next(&mut self) -> Option<Result<LogEvent, LiveLogDirReaderError>>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LiveLogDirReader
impl !RefUnwindSafe for LiveLogDirReader
impl Send for LiveLogDirReader
impl Sync for LiveLogDirReader
impl Unpin for LiveLogDirReader
impl !UnwindSafe for LiveLogDirReader
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