move verbose to debug to align with log and opentelemetry (#541)

This commit is contained in:
bmc-msft
2021-02-11 16:49:27 -05:00
committed by GitHub
parent a3d73a240d
commit 360693e8a4
23 changed files with 68 additions and 72 deletions

View File

@ -58,7 +58,7 @@ async fn run_existing(config: &Config) -> Result<()> {
let mut count = 0;
let mut read_dir = fs::read_dir(&crashes.path).await?;
while let Some(file) = read_dir.next().await {
verbose!("Processing file {:?}", file);
debug!("Processing file {:?}", file);
let file = file?;
run_tool(file.path(), &config).await?;
count += 1;

View File

@ -134,7 +134,7 @@ impl CoverageTask {
let mut seen_inputs = false;
// Update the total with the coverage from each seed corpus.
for dir in &self.config.readonly_inputs {
verbose!("recording coverage for {}", dir.path.display());
debug!("recording coverage for {}", dir.path.display());
dir.init_pull().await?;
if self.record_corpus_coverage(&mut processor, dir).await? {
seen_inputs = true;
@ -227,7 +227,7 @@ impl CoverageProcessor {
.ok_or_else(|| format_err!("module must have filename"))?
.to_os_string();
verbose!("updating module info {:?}", module);
debug!("updating module info {:?}", module);
if !self.module_totals.contains_key(&module) {
let parent = &self.config.coverage.path.join("by-module");
@ -244,7 +244,7 @@ impl CoverageProcessor {
self.module_totals[&module].update_bytes(data).await?;
verbose!("updated {:?}", module);
debug!("updated {:?}", module);
Ok(())
}
@ -254,7 +254,7 @@ impl CoverageProcessor {
let mut sum = Vec::new();
for file in &files {
verbose!("checking {:?}", file);
debug!("checking {:?}", file);
let mut content = fs::read(file)
.await
.with_context(|| format!("unable to read module coverage: {}", file.display()))?;

View File

@ -71,11 +71,11 @@ impl CoverageRecorder {
return Err(err);
} else {
verbose!(
debug!(
"recording stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
verbose!(
debug!(
"recording stdout: {}",
String::from_utf8_lossy(&output.stdout)
);

View File

@ -127,7 +127,7 @@ impl GeneratorTask {
while let Some(file) = read_dir.next().await {
let file = file?;
verbose!("testing input: {:?}", file);
debug!("testing input: {:?}", file);
let destination_file = if self.config.rename_output {
let hash = sha256::digest_file(file.path()).await?;
@ -139,7 +139,7 @@ impl GeneratorTask {
let destination_file = self.config.crashes.path.join(destination_file);
if tester.is_crash(file.path()).await? {
fs::rename(file.path(), &destination_file).await?;
verbose!("crash found {}", destination_file.display());
debug!("crash found {}", destination_file.display());
}
}
Ok(())

View File

@ -168,7 +168,7 @@ impl LibFuzzerFuzzTask {
let crash_dir = tempdir()?;
let run_id = Uuid::new_v4();
verbose!("starting fuzzer run, run_id = {}", run_id);
debug!("starting fuzzer run, run_id = {}", run_id);
let mut inputs = vec![&self.config.inputs.path];
if let Some(readonly_inputs) = &self.config.readonly_inputs {

View File

@ -137,7 +137,7 @@ pub async fn spawn(config: SupervisorConfig) -> Result<(), Error> {
.evaluate_value(stats_file)?,
)
} else {
verbose!("no stats file to monitor");
debug!("no stats file to monitor");
None
};

View File

@ -161,7 +161,7 @@ impl<M> InputPoller<M> {
loop {
match self.state() {
State::Polled(None) => {
verbose!("Input queue empty, sleeping");
debug!("Input queue empty, sleeping");
delay_with_jitter(POLL_INTERVAL).await;
}
State::Downloaded(_msg, _url, input, _tempdir) => {
@ -241,7 +241,7 @@ impl<M> InputPoller<M> {
(Parsed(msg, url), Download(downloader)) => {
let download_dir = tempdir()?;
if self.seen_in_batch(&url).await? {
verbose!("url was seen during batch processing: {:?}", url);
debug!("url was seen during batch processing: {:?}", url);
self.set_state(Processed(msg));
} else {
let input = downloader

View File

@ -53,7 +53,7 @@ pub async fn spawn(config: Arc<Config>) -> Result<()> {
loop {
hb_client.alive();
let tmp_dir = PathBuf::from("./tmp");
verbose!("tmp dir reset");
debug!("tmp dir reset");
utils::reset_tmp_dir(&tmp_dir).await?;
config.unique_inputs.sync_pull().await?;
let mut queue = QueueClient::new(config.input_queue.clone());
@ -72,11 +72,11 @@ pub async fn spawn(config: Arc<Config>) -> Result<()> {
error
);
} else {
verbose!("will delete popped message with id = {}", msg.id());
debug!("will delete popped message with id = {}", msg.id());
queue.delete(msg).await?;
verbose!(
debug!(
"Attempting to delete {} from the candidate container",
input_url.clone()
);

View File

@ -89,7 +89,7 @@ async fn process_message(config: Arc<Config>, mut input_queue: QueueClient) -> R
let hb_client = config.common.init_heartbeat().await?;
hb_client.alive();
let tmp_dir = "./tmp";
verbose!("tmp dir reset");
debug!("tmp dir reset");
utils::reset_tmp_dir(tmp_dir).await?;
if let Some(msg) = input_queue.pop().await? {
@ -105,11 +105,11 @@ async fn process_message(config: Arc<Config>, mut input_queue: QueueClient) -> R
info!("downloaded input to {}", input_path.display());
sync_and_merge(config.clone(), vec![tmp_dir], true, true).await?;
verbose!("will delete popped message with id = {}", msg.id());
debug!("will delete popped message with id = {}", msg.id());
input_queue.delete(msg).await?;
verbose!(
debug!(
"Attempting to delete {} from the candidate container",
input_url.clone()
);

View File

@ -224,7 +224,7 @@ pub async fn monitor_reports(
no_crash: &Option<SyncedDir>,
) -> Result<()> {
if unique_reports.is_none() && reports.is_none() && no_crash.is_none() {
verbose!("no report directories configured");
debug!("no report directories configured");
return Ok(());
}

View File

@ -198,7 +198,7 @@ impl<'a> GenericReportProcessor<'a> {
#[async_trait]
impl<'a> Processor for GenericReportProcessor<'a> {
async fn process(&mut self, url: Option<Url>, input: &Path) -> Result<()> {
verbose!("generating crash report for: {}", input.display());
debug!("generating crash report for: {}", input.display());
let report = self.test_input(url, input).await?;
report
.save(

View File

@ -195,7 +195,7 @@ impl AsanProcessor {
#[async_trait]
impl Processor for AsanProcessor {
async fn process(&mut self, url: Option<Url>, input: &Path) -> Result<()> {
verbose!("processing libfuzzer crash url:{:?} path:{:?}", url, input);
debug!("processing libfuzzer crash url:{:?} path:{:?}", url, input);
let report = self.test_input(url, input).await?;
report
.save(

View File

@ -41,12 +41,12 @@ pub async fn reset_tmp_dir(tmp_dir: impl AsRef<Path>) -> Result<()> {
if dir_exists {
fs::remove_dir_all(tmp_dir).await?;
verbose!("deleted {}", tmp_dir.display());
debug!("deleted {}", tmp_dir.display());
}
fs::create_dir_all(tmp_dir).await?;
verbose!("created {}", tmp_dir.display());
debug!("created {}", tmp_dir.display());
Ok(())
}