#[macro_use] extern crate lazy_static; #[macro_use] extern crate q_debug; use chrono; use regex::Regex; use std::env; use std::fs; use std::io::Read; use std::sync::Mutex; use std::thread::sleep; use std::time; lazy_static! { static ref QFILE: Mutex = { Mutex::new( fs::OpenOptions::new() .read(true) .append(true) .create(true) .open(env::temp_dir().join("q")) .unwrap(), ) }; } // TODO: Move some of these into `Logger` unit tests now that an in memory // buffer can be used instead of reading /tmp/q. // TODO: Improve log line parsing/matching macro_rules! read_log { ($e:expr) => {{ let mut file = QFILE.lock().unwrap(); let mut output = String::new(); file.read_to_string(&mut output).unwrap(); output.clear(); $e; file.read_to_string(&mut output).unwrap(); output.trim().to_owned() }}; } lazy_static! { static ref HEADER_RE: Regex = Regex::new( r"\[(?P