From b5b2c780ffc79a0ff11484aa9a1d8ed01adb48cd Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Tue, 24 Oct 2023 18:14:39 -0700 Subject: [PATCH 01/23] CI build --- .github/workflows/build.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5e36477 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: build + +on: [pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: install hyperscan dependencies + run: sudo apt-get install -y libhyperscan-dev + - name: Run build + run: cargo build \ No newline at end of file From 6e8c556b8d388683b385c7088bd3ff4504390ba1 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Tue, 24 Oct 2023 20:38:53 -0700 Subject: [PATCH 02/23] reuse frame_text buffer --- src/main.rs | 145 +++++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 69 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2fc446a..1c280e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -321,83 +321,75 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { stdout(reader) }; + let mut frame_text = String::new(); for (i, (time, lines, _cursor)) in frames(event_stream, target_is_stdin).enumerate() { - let mut frame_text = String::new(); + frame_text.clear(); for chars in lines.iter() { - let mut line_text = String::new(); - // Collect the text of the line - for (ch, _pen) in chars.iter() { - line_text.push(*ch); - } - // Trim the line and only add it if it's not empty - line_text = line_text.trim_end().to_string(); - if !line_text.is_empty() { - frame_text.push_str(&line_text); + let at = frame_text.len(); + frame_text.extend(chars.iter().map(|(ch, _)| *ch)); + frame_text.truncate(frame_text.trim_end().len()); + if frame_text.len() > at { frame_text.push('\n'); } } - let res = db.scan( - frame_text.clone(), - &scratch, - |_id, from: u64, to, _flags| { - debug!("Match frame {} at {} from {} to {}", i, time, from, to); - match_count += 1; - if match_count > max_matches { - warn!("Maximum number of matches reached; stopping"); - return Matching::Terminate; + let res = db.scan(&frame_text, &scratch, |_id, from: u64, to, _flags| { + debug!("Match frame {} at {} from {} to {}", i, time, from, to); + match_count += 1; + if match_count > max_matches { + warn!("Maximum number of matches reached; stopping"); + return Matching::Terminate; + } + match mi { + None => { + mi = Some(MatchData { + filename: file.to_string(), + start_time, + start_frame: i, + end_frame: i, + start_ts: time, + end_ts: time, + last_frame_text: frame_text.clone(), + match_ranges: vec![(from as usize, to as usize)], + }); + debug!( + "First matching frame found at {} {}", + i, + make_timestamp(start_time, time) + ); } - match mi { - None => { - mi = Some(MatchData { - filename: file.to_string(), - start_time, - start_frame: i, - end_frame: i, - start_ts: time, - end_ts: time, - last_frame_text: frame_text.clone(), - match_ranges: vec![(from as usize, to as usize)], - }); - debug!( - "First matching frame found at {} {}", - i, - make_timestamp(start_time, time) - ); - } - Some(ref mut mi) => { - if i == mi.end_frame + 1 { - // Contiguous - mi.end_frame = i; - mi.end_ts = time; - mi.last_frame_text.clear(); - mi.last_frame_text.push_str(&frame_text); - mi.match_ranges.clear(); - mi.match_ranges.push((from as usize, to as usize)); - debug!("Extended matching frame range to {}", i); - } else if i == mi.end_frame { - // Same frame; add the match to the list - mi.match_ranges.push((from as usize, to as usize)); - debug!("Additional match within the same frame; do nothing"); - } else { - // Not contiguous; display the match. We use the last frame text. - // TODO: consider whether we should do something if there are multiple - // matches in the same frame; by the time we get to the last frame - // some of the matches may have disappeared... - display_match(mi, args); - mi.start_frame = i; - mi.end_frame = i; - mi.start_ts = time; - mi.end_ts = time; - mi.last_frame_text.clear(); - mi.last_frame_text.push_str(&frame_text); - mi.match_ranges.clear(); - mi.match_ranges.push((from as usize, to as usize)); - } + Some(ref mut mi) => { + if i == mi.end_frame + 1 { + // Contiguous + mi.end_frame = i; + mi.end_ts = time; + mi.last_frame_text.clear(); + mi.last_frame_text.push_str(&frame_text); + mi.match_ranges.clear(); + mi.match_ranges.push((from as usize, to as usize)); + debug!("Extended matching frame range to {}", i); + } else if i == mi.end_frame { + // Same frame; add the match to the list + mi.match_ranges.push((from as usize, to as usize)); + debug!("Additional match within the same frame; do nothing"); + } else { + // Not contiguous; display the match. We use the last frame text. + // TODO: consider whether we should do something if there are multiple + // matches in the same frame; by the time we get to the last frame + // some of the matches may have disappeared... + display_match(mi, args); + mi.start_frame = i; + mi.end_frame = i; + mi.start_ts = time; + mi.end_ts = time; + mi.last_frame_text.clear(); + mi.last_frame_text.push_str(&frame_text); + mi.match_ranges.clear(); + mi.match_ranges.push((from as usize, to as usize)); } } - return Matching::Continue; - }, - ); + } + return Matching::Continue; + }); if let Err(e) = res { match e { hyperscan::Error::Hyperscan(ScanTerminated) => { @@ -466,6 +458,21 @@ struct Args { event_type: String, } +struct Search { + args: Args, + pattern: Pattern, +} + +impl Search { + fn new(args: Args) -> Self { + let pattern = pattern! { + args.pattern.clone(); + CompileFlags::SOM_LEFTMOST | CompileFlags::UTF8 | + if args.case_insensitive { CompileFlags::CASELESS } else { CompileFlags::empty() } + }; + } +} + fn main() { let mut args = Args::parse(); From 76ef7cba5b4cb9cbec16b916e77ddff637407170 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Tue, 24 Oct 2023 20:45:42 -0700 Subject: [PATCH 03/23] remove dead experiment --- src/main.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1c280e2..3eb02f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -458,21 +458,6 @@ struct Args { event_type: String, } -struct Search { - args: Args, - pattern: Pattern, -} - -impl Search { - fn new(args: Args) -> Self { - let pattern = pattern! { - args.pattern.clone(); - CompileFlags::SOM_LEFTMOST | CompileFlags::UTF8 | - if args.case_insensitive { CompileFlags::CASELESS } else { CompileFlags::empty() } - }; - } -} - fn main() { let mut args = Args::parse(); From c5b712813aa3770b836954cc0303bcd5bd846373 Mon Sep 17 00:00:00 2001 From: Brendan Dolan-Gavitt Date: Wed, 25 Oct 2023 02:50:39 -0400 Subject: [PATCH 04/23] remove Search and fix clippy warnings --- src/main.rs | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1c280e2..e16293c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,7 +148,7 @@ pub fn frames( stream.filter_map(move |(time, data)| { // For stdin, we need to change \r to \r\n let data = if is_stdin { - data.replace("\r", "\r\n") + data.replace('\r', "\r\n") } else { data }; @@ -276,9 +276,9 @@ fn display_match(matchdata: &MatchData, args: &Args) { ); // Print the matching lines in the frame if args.show_full_frame { - print!("{}", highlight_matches(&matchdata, &args)); + print!("{}", highlight_matches(matchdata, args)); } else { - print!("{}", highlight_matchlines(&matchdata, &args)); + print!("{}", highlight_matchlines(matchdata, args)); } } @@ -388,7 +388,7 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { } } } - return Matching::Continue; + Matching::Continue }); if let Err(e) = res { match e { @@ -458,21 +458,6 @@ struct Args { event_type: String, } -struct Search { - args: Args, - pattern: Pattern, -} - -impl Search { - fn new(args: Args) -> Self { - let pattern = pattern! { - args.pattern.clone(); - CompileFlags::SOM_LEFTMOST | CompileFlags::UTF8 | - if args.case_insensitive { CompileFlags::CASELESS } else { CompileFlags::empty() } - }; - } -} - fn main() { let mut args = Args::parse(); From d13ae38f566a02138187658f79c0f0e332a9a9c1 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:19:50 -0700 Subject: [PATCH 05/23] compile this for me please github sir --- Cargo.lock | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 3 ++ src/main.rs | 26 +++++---- 3 files changed, 171 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b46314..456561d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,6 +83,9 @@ dependencies = [ "log", "serde", "serde_json", + "tracing", + "tracing-chrome", + "tracing-subscriber", "zstd", ] @@ -337,6 +340,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.149" @@ -358,6 +367,16 @@ dependencies = [ "libc", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-traits" version = "0.2.17" @@ -373,6 +392,18 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + [[package]] name = "pkg-config" version = "0.3.27" @@ -458,6 +489,21 @@ dependencies = [ "serde", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + [[package]] name = "strsim" version = "0.10.0" @@ -506,6 +552,84 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "tracing-chrome" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496b3cd5447f7ff527bbbf19b071ad542a000adf297d4127078b4dfdb931f41a" +dependencies = [ + "serde_json", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + [[package]] name = "unicode-ident" version = "1.0.12" @@ -518,6 +642,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "wasm-bindgen" version = "0.2.87" @@ -572,6 +702,28 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-core" version = "0.51.1" diff --git a/Cargo.toml b/Cargo.toml index 5232b69..ceb765c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,9 @@ anstyle = "1.0.1" chrono = "0.4.31" log = "0.4.20" zstd = "0.13.0" +tracing = "0.1.40" +tracing-chrome = "0.7.1" +tracing-subscriber = "0.3.17" [profile.release] debug = 1 diff --git a/src/main.rs b/src/main.rs index 3eb02f5..daaf530 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use std::collections::HashMap; use log::{debug, info, warn}; use std::io::IsTerminal; +use tracing::info as tracing_info; // Annoying to have to do this but by god I need those colors in the help output pub fn get_styles() -> clap::builder::Styles { @@ -129,12 +130,12 @@ fn events( }) } -fn stdout(reader: impl BufRead + 'static) -> Box> { - Box::new(events(reader, Some(EntryKind::Output))) +fn stdout(reader: impl BufRead + 'static) -> impl Iterator { + events(reader, Some(EntryKind::Output)) } -fn stdin(reader: impl BufRead + 'static) -> Box> { - Box::new(events(reader, Some(EntryKind::Input))) +fn stdin(reader: impl BufRead + 'static) -> impl Iterator { + events(reader, Some(EntryKind::Input)) } pub fn frames( @@ -283,20 +284,19 @@ fn display_match(matchdata: &MatchData, args: &Args) { } fn search_file(pattern: &Pattern, file: &str, args: &Args) { + tracing_info!("Searching file {}", file); let db: BlockDatabase = pattern.build().unwrap_or_else(|e| { eprintln!("Error building pattern {}: {}", pattern.expression, e); std::process::exit(1); }); let scratch = db.alloc_scratch().unwrap(); - let mut reader: Box = if file == "-" { - Box::new(BufReader::new(io::stdin())) + let mut reader = if file == "-" { + BufReader::new(io::stdin()) } else if file.ends_with(".zst") { - Box::new(BufReader::new( - zstd::Decoder::new(fs::File::open(file).unwrap()).unwrap(), - )) + BufReader::new(zstd::Decoder::new(fs::File::open(file).unwrap()).unwrap()) } else { - Box::new(BufReader::new(fs::File::open(file).unwrap())) + BufReader::new(fs::File::open(file).unwrap()) }; // Read the header line of the input @@ -459,6 +459,12 @@ struct Args { } fn main() { + use tracing_chrome::ChromeLayerBuilder; + use tracing_subscriber::{prelude::*, registry::Registry}; + + let (chrome_layer, _guard) = ChromeLayerBuilder::new().build(); + tracing_subscriber::registry().with(chrome_layer).init(); + let mut args = Args::parse(); // Validation: make sure that if "-" is specified, it is only used once From 4db5b2d423b6bea35beac7444da496c3cbc99183 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:22:22 -0700 Subject: [PATCH 06/23] ah yes that's very true --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index daaf530..2edbf43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -292,11 +292,13 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { let scratch = db.alloc_scratch().unwrap(); let mut reader = if file == "-" { - BufReader::new(io::stdin()) + Box::new(BufReader::new(io::stdin())) } else if file.ends_with(".zst") { - BufReader::new(zstd::Decoder::new(fs::File::open(file).unwrap()).unwrap()) + Box::new(BufReader::new( + zstd::Decoder::new(fs::File::open(file).unwrap()).unwrap(), + )) } else { - BufReader::new(fs::File::open(file).unwrap()) + Box::new(BufReader::new(fs::File::open(file).unwrap())) }; // Read the header line of the input From 68391bd8857a9d4911b6fb1afce8d061972ed741 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:24:23 -0700 Subject: [PATCH 07/23] right! --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2edbf43..132c55b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -291,7 +291,7 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { }); let scratch = db.alloc_scratch().unwrap(); - let mut reader = if file == "-" { + let mut reader: Box = if file == "-" { Box::new(BufReader::new(io::stdin())) } else if file.ends_with(".zst") { Box::new(BufReader::new( From 1057fec035426eb7658775025e847d0174bd4fac Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:30:12 -0700 Subject: [PATCH 08/23] spell it correctly! --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 132c55b..fa834f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -291,7 +291,7 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { }); let scratch = db.alloc_scratch().unwrap(); - let mut reader: Box = if file == "-" { + let mut reader: Box = if file == "-" { Box::new(BufReader::new(io::stdin())) } else if file.ends_with(".zst") { Box::new(BufReader::new( From 24c85f069efa7cbd6e5ef72ec7484c14d6499a5b Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:36:21 -0700 Subject: [PATCH 09/23] simplifying --- src/main.rs | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index fa834f3..88b4311 100644 --- a/src/main.rs +++ b/src/main.rs @@ -114,17 +114,12 @@ struct MatchData { match_ranges: Vec<(usize, usize)>, } -fn events( - reader: impl BufRead, - event_type: Option, -) -> impl Iterator { +fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator { reader.lines().filter_map(move |line| { let line = line.ok()?; let entry: Entry = serde_json::from_str(&line).ok()?; - if let Some(kind) = event_type { - if entry.kind != kind { - return None; - } + if entry.kind != kind { + return None; } Some((entry.timestamp, entry.data)) }) @@ -139,14 +134,18 @@ fn stdin(reader: impl BufRead + 'static) -> impl Iterator } pub fn frames( - stream: impl Iterator, + reader: Box, is_stdin: bool, ) -> impl Iterator>, Option<(usize, usize)>)> { // 1000 chars should be enough for anyone let mut vt = Vt::new(1000, 100); let mut prev_cursor = None; - - stream.filter_map(move |(time, data)| { + let event_type = if is_stdin { + EntryKind::Input + } else { + EntryKind::Output + }; + events(reader, event_type).filter_map(move |(time, data)| { // For stdin, we need to change \r to \r\n let data = if is_stdin { data.replace("\r", "\r\n") @@ -317,14 +316,9 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { // Collect matching frames let mut mi: Option = None; let target_is_stdin = args.event_type == "stdin"; - let event_stream = if target_is_stdin { - stdin(reader) - } else { - stdout(reader) - }; let mut frame_text = String::new(); - for (i, (time, lines, _cursor)) in frames(event_stream, target_is_stdin).enumerate() { + for (i, (time, lines, _cursor)) in frames(reader, target_is_stdin).enumerate() { frame_text.clear(); for chars in lines.iter() { let at = frame_text.len(); From 700cb57a5bea102b0da4de2825af7e596cc306d0 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:38:09 -0700 Subject: [PATCH 10/23] compiling remotely is fun! --- src/main.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 88b4311..4f5cb1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,21 +118,13 @@ fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator impl Iterator { - events(reader, Some(EntryKind::Output)) -} - -fn stdin(reader: impl BufRead + 'static) -> impl Iterator { - events(reader, Some(EntryKind::Input)) -} - pub fn frames( reader: Box, is_stdin: bool, From 8620f0bb7397adc9bac1b130cb6b7f02dab5ea1a Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:42:46 -0700 Subject: [PATCH 11/23] trying a caching build --- .github/workflows/build.yml | 6 ++++-- src/main.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e36477..35d4808 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,5 +12,7 @@ jobs: uses: actions/checkout@v3 - name: install hyperscan dependencies run: sudo apt-get install -y libhyperscan-dev - - name: Run build - run: cargo build \ No newline at end of file + - uses: moonrepo/setup-rust@v1 + with: + profile: minimal + run: cargo check \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 4f5cb1a..002ece0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -448,7 +448,7 @@ struct Args { fn main() { use tracing_chrome::ChromeLayerBuilder; - use tracing_subscriber::{prelude::*, registry::Registry}; + use tracing_subscriber::prelude::*; let (chrome_layer, _guard) = ChromeLayerBuilder::new().build(); tracing_subscriber::registry().with(chrome_layer).init(); From da6b0313f8656dd97028277813978622c41e46d1 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:44:07 -0700 Subject: [PATCH 12/23] try a valid action this time --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35d4808..eafd931 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,9 @@ jobs: uses: actions/checkout@v3 - name: install hyperscan dependencies run: sudo apt-get install -y libhyperscan-dev - - uses: moonrepo/setup-rust@v1 + - name: set up rust + uses: moonrepo/setup-rust@v1 with: profile: minimal + - name: run cargo check run: cargo check \ No newline at end of file From 813bc53332898105f346d71eb7ade95046973efb Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:50:10 -0700 Subject: [PATCH 13/23] removing Pen as a test --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 002ece0..91cdfcf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -128,7 +128,7 @@ fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator, is_stdin: bool, -) -> impl Iterator>, Option<(usize, usize)>)> { +) -> impl Iterator, Option<(usize, usize)>)> { // 1000 chars should be enough for anyone let mut vt = Vt::new(1000, 100); let mut prev_cursor = None; @@ -153,7 +153,7 @@ pub fn frames( let lines = vt .view() .iter() - .map(|line| line.cells().collect()) + .map(|line| line.cells().map(|(c, _)| *c).collect()) .collect(); Some((time, lines, cursor)) @@ -312,10 +312,9 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { let mut frame_text = String::new(); for (i, (time, lines, _cursor)) in frames(reader, target_is_stdin).enumerate() { frame_text.clear(); - for chars in lines.iter() { + for line in lines.iter() { let at = frame_text.len(); - frame_text.extend(chars.iter().map(|(ch, _)| *ch)); - frame_text.truncate(frame_text.trim_end().len()); + frame_text.push_str(line.trim_end()); if frame_text.len() > at { frame_text.push('\n'); } From 07f8548ee7d9ede2c2eaaed2911919cf0b8a56a5 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 10:51:32 -0700 Subject: [PATCH 14/23] ah make it compile --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 91cdfcf..8a0e1c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,7 +153,7 @@ pub fn frames( let lines = vt .view() .iter() - .map(|line| line.cells().map(|(c, _)| *c).collect()) + .map(|line| line.cells().map(|(c, _)| c).collect()) .collect(); Some((time, lines, cursor)) From c15bc93fb1ec3404cdd199c3feda61dbb778f577 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 11:02:33 -0700 Subject: [PATCH 15/23] collapsing some stages --- src/main.rs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8a0e1c5..6651b73 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,17 +118,18 @@ fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator, is_stdin: bool, -) -> impl Iterator, Option<(usize, usize)>)> { +) -> impl Iterator)> { // 1000 chars should be enough for anyone let mut vt = Vt::new(1000, 100); let mut prev_cursor = None; @@ -153,7 +154,13 @@ pub fn frames( let lines = vt .view() .iter() - .map(|line| line.cells().map(|(c, _)| c).collect()) + .map(|line| { + line.cells() + .map(|(c, _)| c) + .chain(Some('\n')) + .collect::() + }) + .filter(|line| !line.trim_end().is_empty()) .collect(); Some((time, lines, cursor)) @@ -309,16 +316,7 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { let mut mi: Option = None; let target_is_stdin = args.event_type == "stdin"; - let mut frame_text = String::new(); - for (i, (time, lines, _cursor)) in frames(reader, target_is_stdin).enumerate() { - frame_text.clear(); - for line in lines.iter() { - let at = frame_text.len(); - frame_text.push_str(line.trim_end()); - if frame_text.len() > at { - frame_text.push('\n'); - } - } + for (i, (time, frame_text, _cursor)) in frames(reader, target_is_stdin).enumerate() { let res = db.scan(&frame_text, &scratch, |_id, from: u64, to, _flags| { debug!("Match frame {} at {} from {} to {}", i, time, from, to); match_count += 1; From be43429661d817cc480844e16f0989d09862e686 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 15:21:07 -0700 Subject: [PATCH 16/23] eliminate an option --- src/main.rs | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index ca19011..2d2f367 100644 --- a/src/main.rs +++ b/src/main.rs @@ -129,7 +129,7 @@ fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator, is_stdin: bool, -) -> impl Iterator)> { +) -> impl Iterator { // 1000 chars should be enough for anyone let mut vt = Vt::new(1000, 100); let mut prev_cursor = None; @@ -146,26 +146,25 @@ pub fn frames( data }; let (changed_lines, _) = vt.feed_str(&data); - let cursor: Option<(usize, usize)> = vt.cursor().into(); + let cursor = vt.cursor(); - if !changed_lines.is_empty() || cursor != prev_cursor { - prev_cursor = cursor; + if !changed_lines.is_empty() || Some(cursor) != prev_cursor { + prev_cursor = Some(cursor); - let lines = vt - .view() + // is this a good way to get a size hint for this? going to reallocate a lot i think but everything underneath is Vecs so this should work + let lower_bound = vt + .lines() .iter() - .map(|line| { - line.cells() - .map(|(c, _)| c) - .chain(Some('\n')) - .collect::() - }) - .filter(|line| !line.trim_end().is_empty()) - .collect(); - - Some((time, lines, cursor)) + .map(|line| line.cells().size_hint().0 + 1) + .sum::(); + let mut frame_text = String::with_capacity(lower_bound); + for line in vt.view() { + frame_text.extend(line.chars().chain(Some('\n'))); + } + + Some((time, frame_text, cursor.into())) } else { - prev_cursor = cursor; + prev_cursor = Some(cursor); None } From 0502a4f8320f33004d0c1c003793006c7bfbbf5f Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 15:25:18 -0700 Subject: [PATCH 17/23] nope --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2d2f367..32acf6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -129,10 +129,10 @@ fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator, is_stdin: bool, -) -> impl Iterator { +) -> impl Iterator)> { // 1000 chars should be enough for anyone let mut vt = Vt::new(1000, 100); - let mut prev_cursor = None; + let mut prev_cursor: Option<(usize, usize)> = None; let event_type = if is_stdin { EntryKind::Input } else { @@ -146,10 +146,10 @@ pub fn frames( data }; let (changed_lines, _) = vt.feed_str(&data); - let cursor = vt.cursor(); + let cursor = vt.cursor().into(); - if !changed_lines.is_empty() || Some(cursor) != prev_cursor { - prev_cursor = Some(cursor); + if !changed_lines.is_empty() || cursor != prev_cursor { + prev_cursor = cursor; // is this a good way to get a size hint for this? going to reallocate a lot i think but everything underneath is Vecs so this should work let lower_bound = vt @@ -164,7 +164,7 @@ pub fn frames( Some((time, frame_text, cursor.into())) } else { - prev_cursor = Some(cursor); + prev_cursor = cursor; None } From 25200f94ae3808ae6a577cc67db648730baa099c Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 15:30:41 -0700 Subject: [PATCH 18/23] smarter way to get the size of the frame also dropping pure whitespace from the frame --- src/main.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 32acf6c..62054b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -151,14 +151,12 @@ pub fn frames( if !changed_lines.is_empty() || cursor != prev_cursor { prev_cursor = cursor; - // is this a good way to get a size hint for this? going to reallocate a lot i think but everything underneath is Vecs so this should work - let lower_bound = vt - .lines() - .iter() - .map(|line| line.cells().size_hint().0 + 1) - .sum::(); + // is this a good way to get a size hint for this? + // everything underneath is Vecs so this should work + let lower_bound = vt.lines().iter().map(|line| line.len() + 1).sum::(); let mut frame_text = String::with_capacity(lower_bound); for line in vt.view() { + frame_text.truncate(frame_text.trim_end().len()); frame_text.extend(line.chars().chain(Some('\n'))); } From 3dbe9005037fbadc2ccf0947b83f45ff82f0d43f Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 15:39:56 -0700 Subject: [PATCH 19/23] trying a quick run --- .github/workflows/build.yml | 4 +++- src/main.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eafd931..fa36307 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,4 +17,6 @@ jobs: with: profile: minimal - name: run cargo check - run: cargo check \ No newline at end of file + run: cargo check + - name: fun fun fun + run: cargo run --release -- resume testdata/hello.cast \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 62054b9..31f9462 100644 --- a/src/main.rs +++ b/src/main.rs @@ -160,7 +160,7 @@ pub fn frames( frame_text.extend(line.chars().chain(Some('\n'))); } - Some((time, frame_text, cursor.into())) + Some((time, frame_text, cursor)) } else { prev_cursor = cursor; From 57ff95329d3d9a72286fb3da9877a3bccf13a9a2 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 15:55:49 -0700 Subject: [PATCH 20/23] trimming needs a wash --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 31f9462..08c1972 100644 --- a/src/main.rs +++ b/src/main.rs @@ -154,11 +154,13 @@ pub fn frames( // is this a good way to get a size hint for this? // everything underneath is Vecs so this should work let lower_bound = vt.lines().iter().map(|line| line.len() + 1).sum::(); + println!("lower bound: {lower_bound}"); let mut frame_text = String::with_capacity(lower_bound); for line in vt.view() { - frame_text.truncate(frame_text.trim_end().len()); + // frame_text.truncate(frame_text.trim_end().len()); frame_text.extend(line.chars().chain(Some('\n'))); } + println!("frame text length: {len}", len = frame_text.len()); Some((time, frame_text, cursor)) } else { From 8d4b98b0f3f9b14c05711a52d27582b05c487471 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 16:06:27 -0700 Subject: [PATCH 21/23] trying to bound things --- src/main.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 08c1972..c5c644c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,8 +87,8 @@ type Env = HashMap; #[derive(Serialize, Deserialize, Debug)] struct Header { version: u8, - width: u16, - height: u16, + width: usize, + height: usize, env: Option, timestamp: Option, command: Option, @@ -129,9 +129,10 @@ fn events(reader: impl BufRead, event_type: EntryKind) -> impl Iterator, is_stdin: bool, + width: usize, + height: usize, ) -> impl Iterator)> { - // 1000 chars should be enough for anyone - let mut vt = Vt::new(1000, 100); + let mut vt = Vt::new(width, height); let mut prev_cursor: Option<(usize, usize)> = None; let event_type = if is_stdin { EntryKind::Input @@ -151,16 +152,18 @@ pub fn frames( if !changed_lines.is_empty() || cursor != prev_cursor { prev_cursor = cursor; - // is this a good way to get a size hint for this? - // everything underneath is Vecs so this should work - let lower_bound = vt.lines().iter().map(|line| line.len() + 1).sum::(); - println!("lower bound: {lower_bound}"); + // it seems like the terminal uses this much? let's see! + let lower_bound = width * height; let mut frame_text = String::with_capacity(lower_bound); for line in vt.view() { // frame_text.truncate(frame_text.trim_end().len()); frame_text.extend(line.chars().chain(Some('\n'))); } - println!("frame text length: {len}", len = frame_text.len()); + println!( + "frame_text: {len}, {capacity}", + len = frame_text.len(), + capacity = frame_text.capacity() + ); Some((time, frame_text, cursor)) } else { @@ -315,7 +318,9 @@ fn search_file(pattern: &Pattern, file: &str, args: &Args) { let mut mi: Option = None; let target_is_stdin = args.event_type == "stdin"; - for (i, (time, frame_text, _cursor)) in frames(reader, target_is_stdin).enumerate() { + for (i, (time, frame_text, _cursor)) in + frames(reader, target_is_stdin, header.width, header.height).enumerate() + { let res = db.scan(&frame_text, &scratch, |_id, from: u64, to, _flags| { debug!("Match frame {} at {} from {} to {}", i, time, from, to); match_count += 1; From 17cbc8ef0db6010da37fe3990e39221306c609f6 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 16:09:22 -0700 Subject: [PATCH 22/23] blank line removal, debug frame text stats --- src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index c5c644c..5acdace 100644 --- a/src/main.rs +++ b/src/main.rs @@ -156,11 +156,12 @@ pub fn frames( let lower_bound = width * height; let mut frame_text = String::with_capacity(lower_bound); for line in vt.view() { - // frame_text.truncate(frame_text.trim_end().len()); - frame_text.extend(line.chars().chain(Some('\n'))); + frame_text.extend(line.chars()); + frame_text.truncate(frame_text.trim_end().len()); + frame_text.push('\n'); } - println!( - "frame_text: {len}, {capacity}", + debug!( + "frame_text: len {len}, cap {capacity}", len = frame_text.len(), capacity = frame_text.capacity() ); From 5ed32160c200133509754bbe18dc86efbaa3a7b3 Mon Sep 17 00:00:00 2001 From: Jay Miller Date: Wed, 25 Oct 2023 16:14:37 -0700 Subject: [PATCH 23/23] remove the tracing diversion --- Cargo.lock | 152 ---------------------------------------------------- Cargo.toml | 3 -- src/main.rs | 8 --- 3 files changed, 163 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 456561d..0b46314 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,9 +83,6 @@ dependencies = [ "log", "serde", "serde_json", - "tracing", - "tracing-chrome", - "tracing-subscriber", "zstd", ] @@ -340,12 +337,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "libc" version = "0.2.149" @@ -367,16 +358,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-traits" version = "0.2.17" @@ -392,18 +373,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - [[package]] name = "pkg-config" version = "0.3.27" @@ -489,21 +458,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "smallvec" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" - [[package]] name = "strsim" version = "0.10.0" @@ -552,84 +506,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "tracing-chrome" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496b3cd5447f7ff527bbbf19b071ad542a000adf297d4127078b4dfdb931f41a" -dependencies = [ - "serde_json", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "nu-ansi-term", - "sharded-slab", - "smallvec", - "thread_local", - "tracing-core", - "tracing-log", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -642,12 +518,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "wasm-bindgen" version = "0.2.87" @@ -702,28 +572,6 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.51.1" diff --git a/Cargo.toml b/Cargo.toml index ceb765c..5232b69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,9 +16,6 @@ anstyle = "1.0.1" chrono = "0.4.31" log = "0.4.20" zstd = "0.13.0" -tracing = "0.1.40" -tracing-chrome = "0.7.1" -tracing-subscriber = "0.3.17" [profile.release] debug = 1 diff --git a/src/main.rs b/src/main.rs index 5acdace..c1688a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,6 @@ use std::collections::HashMap; use log::{debug, info, warn}; use std::io::IsTerminal; -use tracing::info as tracing_info; // Annoying to have to do this but by god I need those colors in the help output pub fn get_styles() -> clap::builder::Styles { @@ -285,7 +284,6 @@ fn display_match(matchdata: &MatchData, args: &Args) { } fn search_file(pattern: &Pattern, file: &str, args: &Args) { - tracing_info!("Searching file {}", file); let db: BlockDatabase = pattern.build().unwrap_or_else(|e| { eprintln!("Error building pattern {}: {}", pattern.expression, e); std::process::exit(1); @@ -449,12 +447,6 @@ struct Args { } fn main() { - use tracing_chrome::ChromeLayerBuilder; - use tracing_subscriber::prelude::*; - - let (chrome_layer, _guard) = ChromeLayerBuilder::new().build(); - tracing_subscriber::registry().with(chrome_layer).init(); - let mut args = Args::parse(); // Validation: make sure that if "-" is specified, it is only used once