Add brain debug trace
parent
2576f4c48a
commit
410740ea21
|
@ -31,13 +31,14 @@ impl Data {
|
||||||
.create(true)
|
.create(true)
|
||||||
.open(&path)
|
.open(&path)
|
||||||
.await?;
|
.await?;
|
||||||
let mut content = String::new();
|
let mut contents = String::new();
|
||||||
file.read_to_string(&mut content).await?;
|
file.read_to_string(&mut contents).await?;
|
||||||
let brain = if content.is_empty() {
|
tracing::debug!("loaded brain contents: {contents}");
|
||||||
|
let brain = if contents.is_empty() {
|
||||||
tracing::info!("initializing brain at {}", path.as_ref().display());
|
tracing::info!("initializing brain at {}", path.as_ref().display());
|
||||||
Default::default()
|
Default::default()
|
||||||
} else {
|
} 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());
|
tracing::info!("loaded brain from {}", path.as_ref().display());
|
||||||
Mutex::new(brain)
|
Mutex::new(brain)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue