Add brain debug trace
parent
2576f4c48a
commit
410740ea21
|
@ -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)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue