aboutsummaryrefslogtreecommitdiff
path: root/src/filters/log.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-05-12 13:51:09 +0200
committerDaniel <kingdread@gmx.de>2020-05-12 13:51:09 +0200
commit371186e872df3518bb5a2894f487ec02a42c771a (patch)
tree1f49b34df2f9d44708076928d3868534064f634a /src/filters/log.rs
parentf2f2582d546327be9e0254dea8370a9bb6b749f7 (diff)
downloadraidgrep-371186e872df3518bb5a2894f487ec02a42c771a.tar.gz
raidgrep-371186e872df3518bb5a2894f487ec02a42c771a.tar.bz2
raidgrep-371186e872df3518bb5a2894f487ec02a42c771a.zip
add a -cm filter
Diffstat (limited to 'src/filters/log.rs')
-rw-r--r--src/filters/log.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/filters/log.rs b/src/filters/log.rs
index b9843e9..79513d5 100644
--- a/src/filters/log.rs
+++ b/src/filters/log.rs
@@ -186,6 +186,20 @@ pub fn log_before(when: DateTime<Utc>) -> Box<dyn LogFilter> {
log_time(None, Some(when))
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+struct CmFilter;
+
+impl Filter<EarlyLogResult, LogResult> for CmFilter {
+ fn filter(&self, log: &LogResult) -> bool {
+ log.is_cm
+ }
+}
+
+/// A filter that only includes logs that had the Challenge Mote turned on.
+pub fn challenge_mote() -> Box<dyn LogFilter> {
+ Box::new(CmFilter)
+}
+
#[cfg(test)]
mod tests {
use super::*;