refactor(filesystem): Use info! rather than event!

This commit is contained in:
Paul Campbell 2024-04-07 13:26:02 +01:00
parent 7155cf7628
commit 2c07bb5af3

View file

@ -7,7 +7,7 @@ use std::{
}; };
use tempfile::{tempdir, TempDir}; use tempfile::{tempdir, TempDir};
use tracing::{event, Level}; use tracing::info;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum FileSystem { pub enum FileSystem {
@ -46,7 +46,7 @@ pub trait FileSystemEnv: Sync + Send + std::fmt::Debug {
use std::io::{LineWriter, Write}; use std::io::{LineWriter, Write};
let path = self.in_cwd(file_name); let path = self.in_cwd(file_name);
event!(Level::INFO, "writing to {:?}", path); info!("writing to {:?}", path);
let file = File::create(path.clone())?; let file = File::create(path.clone())?;
let mut file = LineWriter::new(file); let mut file = LineWriter::new(file);
file.write_all(content.as_bytes())?; file.write_all(content.as_bytes())?;
@ -91,7 +91,7 @@ impl RealFileSystemEnv {
impl TempFileSystemEnv { impl TempFileSystemEnv {
fn new() -> std::io::Result<Self> { fn new() -> std::io::Result<Self> {
let temp_dir = tempdir()?; let temp_dir = tempdir()?;
event!(Level::INFO, "temp dir: {:?}", temp_dir.path()); info!("temp dir: {:?}", temp_dir.path());
let cwd = temp_dir.path().to_path_buf(); let cwd = temp_dir.path().to_path_buf();
let temp_dir = Arc::new(Mutex::new(temp_dir)); let temp_dir = Arc::new(Mutex::new(temp_dir));
Ok(Self { cwd, temp_dir }) Ok(Self { cwd, temp_dir })