Fixes #404: Use log.rs and a file-per-thread logger instead of the dbg! macro;

This commit is contained in:
Benjamin Bouvier
2018-07-20 19:14:04 +02:00
committed by Dan Gohman
parent 60c2cad06e
commit a044f58cea
27 changed files with 123 additions and 221 deletions

View File

@@ -3,7 +3,9 @@
//! This module provides the `ConcurrentRunner` struct which uses a pool of threads to run tests
//! concurrently.
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
use cranelift_codegen::timing;
use file_per_thread_logger;
use num_cpus;
use std::panic::catch_unwind;
use std::path::{Path, PathBuf};
@@ -100,6 +102,7 @@ fn heartbeat_thread(replies: Sender<Reply>) -> thread::JoinHandle<()> {
thread::Builder::new()
.name("heartbeat".to_string())
.spawn(move || {
file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
while replies.send(Reply::Tick).is_ok() {
thread::sleep(Duration::from_secs(1));
}
@@ -116,6 +119,7 @@ fn worker_thread(
thread::Builder::new()
.name(format!("worker #{}", thread_num))
.spawn(move || {
file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
loop {
// Lock the mutex only long enough to extract a request.
let Request(jobid, path) = match requests.lock().unwrap().recv() {
@@ -140,7 +144,7 @@ fn worker_thread(
});
if let Err(ref msg) = result {
dbg!("FAIL: {}", msg);
error!("FAIL: {}", msg);
}
replies.send(Reply::Done { jobid, result }).unwrap();