New dbg function

This commit is contained in:
Ferran Basora 2020-12-01 10:13:49 +00:00
parent b0812d6b7b
commit 580d9ebcf1
2 changed files with 20 additions and 0 deletions

View File

@ -12,6 +12,16 @@ use clap::crate_version;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io::{self, Read, Write}; use std::io::{self, Read, Write};
#[allow(dead_code)]
fn dbg(msg: &str) {
let mut file = std::fs::OpenOptions::new()
.append(true)
.open("/tmp/thumbs.log")
.expect("Unable to open log file");
writeln!(&mut file, "{}", msg).expect("Unable to write log file");
}
fn app_args<'a>() -> clap::ArgMatches<'a> { fn app_args<'a>() -> clap::ArgMatches<'a> {
App::new("thumbs") App::new("thumbs")
.version(crate_version!()) .version(crate_version!())

View File

@ -43,6 +43,16 @@ impl Executor for RealShell {
const TMP_FILE: &str = "/tmp/thumbs-last"; const TMP_FILE: &str = "/tmp/thumbs-last";
#[allow(dead_code)]
fn dbg(msg: &str) {
let mut file = std::fs::OpenOptions::new()
.append(true)
.open("/tmp/thumbs.log")
.expect("Unable to open log file");
writeln!(&mut file, "{}", msg).expect("Unable to write log file");
}
pub struct Swapper<'a> { pub struct Swapper<'a> {
executor: Box<&'a mut dyn Executor>, executor: Box<&'a mut dyn Executor>,
dir: String, dir: String,