29 lines
1.0 KiB
Rust
29 lines
1.0 KiB
Rust
// use std::io::{self, BufRead};
|
|
// use atty::Stream;
|
|
|
|
use sift::log_database::LogDatabase;
|
|
use sift::log_parser::TextParser;
|
|
|
|
fn main() {
|
|
// if atty::is(Stream::Stdin) {
|
|
// println!("no pipe");
|
|
// return;
|
|
// }
|
|
|
|
// let stdin = io::stdin();
|
|
// for line in stdin.lock().lines() {
|
|
// let line = line.expect("Failed to read line from stdin");
|
|
// println!("{}", line);
|
|
// }
|
|
|
|
let mut log_database = LogDatabase::new(TextParser { separator: None });
|
|
log_database.ingest(String::from("hello world")).unwrap();
|
|
log_database.ingest(String::from("have a good hello")).unwrap();
|
|
log_database.ingest(String::from("goodbye world")).unwrap();
|
|
|
|
println!("hello {:?}", log_database.find_value_string("hello").collect::<Vec<_>>());
|
|
println!("have {:?}", log_database.find_value_string("have").collect::<Vec<_>>());
|
|
println!("world {:?}", log_database.find_value_string("world").collect::<Vec<_>>());
|
|
println!("elliot {:?}", log_database.find_value_string("elliot").collect::<Vec<_>>());
|
|
}
|