Initial commit, basic indexing and plain text parsing
This commit is contained in:
28
src/main.rs
Normal file
28
src/main.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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<_>>());
|
||||
}
|
||||
Reference in New Issue
Block a user