Skip to content

Commit

Permalink
refactor: added logs
Browse files Browse the repository at this point in the history
  • Loading branch information
m62624 committed Aug 31, 2023
1 parent c57b5d7 commit ae6561b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
22 changes: 20 additions & 2 deletions flexible_inspect_rs/src/rules/rule_bytes/runner_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,16 @@ fn single_range_bytes_check<
T::from_utf8(num.as_bytes().unwrap())
}
};
num.map(|num| range.contains(&num)).unwrap_or(false)
num.map(|num| {
if range.contains(&num) {
info!("range contains {:?}", num);
true
} else {
info!("range does not contain {:?}", num);
false
}
})
.unwrap_or(false)
})
.count()
== numbers.text_for_capture.len()
Expand Down Expand Up @@ -134,7 +143,16 @@ fn single_range_bytes_check<
T::from_utf8(num.as_bytes().unwrap())
}
};
num.map(|num| range.contains(&num)).unwrap_or(false)
num.map(|num| {
if range.contains(&num) {
info!("range contains {:?}", num);
true
} else {
info!("range does not contain {:?}", num);
false
}
})
.unwrap_or(false)
})
.take(required_count)
.count()
Expand Down
33 changes: 28 additions & 5 deletions flexible_inspect_rs/src/rules/rule_str/runner_range.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use log::info;

use super::rules::{next::NextStep, traits::IntoSpecificCaptureType};
use super::{convert::convert_and_filter, *};
use log::info;
use std::{
fmt::{Debug, Display},
ops::RangeInclusive,
Expand Down Expand Up @@ -29,7 +28,15 @@ fn single_range_str_check<
.iter()
.filter(|&num| {
convert_and_filter(num.as_str().unwrap())
.map(|num| range.contains(&num))
.map(|num| {
if range.contains(&num) {
info!("range contains {:?}", num);
true
} else {
info!("range does not contain {:?}", num);
false
}
})
.unwrap_or(false)
})
.count()
Expand All @@ -46,7 +53,15 @@ fn single_range_str_check<
.iter()
.filter(|&num| {
convert_and_filter(num.as_str().unwrap())
.map(|num| range.contains(&num))
.map(|num| {
if range.contains(&num) {
info!("range contains {:?}", num);
true
} else {
info!("range does not contain {:?}", num);
false
}
})
.unwrap_or(false)
})
.count()
Expand All @@ -64,7 +79,15 @@ fn single_range_str_check<
.iter()
.filter(|&num| {
convert_and_filter(num.as_str().unwrap())
.map(|num| range.contains(&num))
.map(|num| {
if range.contains(&num) {
info!("range contains {:?}", num);
true
} else {
info!("range does not contain {:?}", num);
false
}
})
.unwrap_or(false)
})
.take(required_count)
Expand Down

0 comments on commit ae6561b

Please sign in to comment.