From 410740ea212ffd86b3b8c05292d486afc437e53f Mon Sep 17 00:00:00 2001 From: mat ess Date: Fri, 3 Mar 2023 00:54:12 -0500 Subject: [PATCH] Add brain debug trace --- src/commands.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index e17668c..5669d54 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -31,13 +31,14 @@ impl Data { .create(true) .open(&path) .await?; - let mut content = String::new(); - file.read_to_string(&mut content).await?; - let brain = if content.is_empty() { + let mut contents = String::new(); + file.read_to_string(&mut contents).await?; + tracing::debug!("loaded brain contents: {contents}"); + let brain = if contents.is_empty() { tracing::info!("initializing brain at {}", path.as_ref().display()); Default::default() } else { - let brain = ron::from_str(content.as_str())?; + let brain = ron::from_str(contents.as_str())?; tracing::info!("loaded brain from {}", path.as_ref().display()); Mutex::new(brain) };