mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-01 01:50:00 -07:00
parser: setup clap
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::process::Output;
|
||||
use std::{fs::OpenOptions, io::Write, process::Output};
|
||||
|
||||
use chrono::Local;
|
||||
use color_eyre::owo_colors::OwoColorize;
|
||||
@@ -10,6 +10,16 @@ pub fn log(str: &str) {
|
||||
str.lines()
|
||||
.filter(|line| !line.is_empty())
|
||||
.for_each(|line| {
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open("./parser.log")
|
||||
.unwrap();
|
||||
|
||||
if let Err(e) = writeln!(file, "{} {}", date_time, line) {
|
||||
eprintln!("Couldn't write to file: {}", e);
|
||||
}
|
||||
|
||||
println!("{} {}", date_time.bright_black(), line);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user