#[cfg(not(windows))]
use crate::error::Error;
use crate::error::Result;
use crate::event::Event;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum QueryDirection {
Forward,
Reverse,
}
pub struct EventLog;
impl EventLog {
pub fn query(
channel: &str,
xpath: &str,
direction: QueryDirection,
) -> Result<Box<dyn Iterator<Item = Result<Event>>>> {
#[cfg(windows)]
{
let iter = crate::platform::WinEventIter::open(channel, xpath, direction)?;
Ok(Box::new(iter))
}
#[cfg(not(windows))]
{
let _ = (channel, xpath, direction);
Err(Error::UnsupportedPlatform)
}
}
}