From 5d97c2ad5fbe5a44750295e750e65569e6a783fb Mon Sep 17 00:00:00 2001 From: phiresky Date: Wed, 20 May 2020 15:55:12 +0200 Subject: [PATCH] log which command is being run in spawning file adapters --- src/adapters/spawning.rs | 5 ++++- src/matching.rs | 4 ++-- src/preproc.rs | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/adapters/spawning.rs b/src/adapters/spawning.rs index 37c65d9..8c632bd 100644 --- a/src/adapters/spawning.rs +++ b/src/adapters/spawning.rs @@ -1,6 +1,7 @@ use super::*; use encoding_rs_io::DecodeReaderBytesBuilder; use failure::*; +use log::*; use std::io::prelude::*; use std::io::BufReader; use std::process::Command; @@ -117,9 +118,11 @@ where .. } = ai; let cmd = Command::new(self.get_exe()); + let cmd = self.command(filepath_hint, cmd); + debug!("executing {:?}", cmd); pipe_output( line_prefix, - self.command(filepath_hint, cmd), + cmd, &mut inp, oup, self.get_exe(), diff --git a/src/matching.rs b/src/matching.rs index cb68e7e..2f4c6ef 100644 --- a/src/matching.rs +++ b/src/matching.rs @@ -11,7 +11,7 @@ use std::iter::Iterator; use std::rc::Rc; -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum FastMatcher { // MimeType(Regex), /** @@ -23,7 +23,7 @@ pub enum FastMatcher { // todo: maybe allow matching a directory (e.g. /var/lib/postgres) } -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum SlowMatcher { /// any type of fast matcher Fast(FastMatcher), diff --git a/src/preproc.rs b/src/preproc.rs index 495133e..36b3a40 100644 --- a/src/preproc.rs +++ b/src/preproc.rs @@ -65,6 +65,10 @@ pub fn rga_preproc(ai: AdaptInfo) -> Fallible<()> { match adapter { Some((adapter, detection_reason)) => { let meta = adapter.metadata(); + debug!( + "chose adapter '{}' because of matcher {:?}", + &meta.name, &detection_reason + ); eprintln!("adapter: {}", &meta.name); let db_name = format!("{}.v{}", meta.name, meta.version); if let Some(cache) = cache.as_mut() {