fix: add logs for goose run (#1085)

This commit is contained in:
Salman Mohammed
2025-02-05 10:53:35 -05:00
committed by GitHub
parent a04b528798
commit 64bb9e9ca6
2 changed files with 4 additions and 3 deletions

View File

@@ -180,7 +180,6 @@ async fn main() -> Result<()> {
}) => {
let mut session = build_session(name, resume, extension, builtin).await;
setup_logging(session.session_file().file_stem().and_then(|s| s.to_str()))?;
let _ = session.start().await;
return Ok(());
}
@@ -211,6 +210,7 @@ async fn main() -> Result<()> {
stdin
};
let mut session = build_session(name, resume, extension, builtin).await;
setup_logging(session.session_file().file_stem().and_then(|s| s.to_str()))?;
let _ = session.headless_start(contents.clone()).await;
return Ok(());
}

View File

@@ -309,6 +309,9 @@ We've removed the conversation up to the most recent user message
}
async fn close_session(&mut self) {
let usage = self.agent.usage().await;
log_usage(self.session_file.to_string_lossy().to_string(), usage);
self.prompt.render(raw_message(
format!(
"Closing session. Recorded to {}\n",
@@ -317,8 +320,6 @@ We've removed the conversation up to the most recent user message
.as_str(),
));
self.prompt.close();
let usage = self.agent.usage().await;
log_usage(self.session_file.to_string_lossy().to_string(), usage);
}
pub fn session_file(&self) -> PathBuf {