Skip to content

Commit

Permalink
add better logging format
Browse files Browse the repository at this point in the history
  • Loading branch information
rauner committed Apr 9, 2024
1 parent ce6c00b commit c09cd4a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
62 changes: 62 additions & 0 deletions rust_bot/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rust_bot/src/assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ pub async fn assistant_chat_handler_form(
let user_id = &assistant_chat_form.user_id;
let message = &assistant_chat_form.message;
// log user_id and message
info!("User ID: {}, Message: {}", user_id, message);
info!("chat_id: {}, message: {}", user_id, message);
// Initialize chat or get existing chat_id
let chat_id = match db.get_chat_id(user_id).await? {
Some(id) => id,
Expand All @@ -854,6 +854,8 @@ pub async fn assistant_chat_handler_form(
new_chat_id
}
};
// log user_id and message
info!("chat_id: {}", chat_id);
// Save the user's message to the database
db.save_message_to_db(&chat_id.to_string(), "user", message)
.await?;
Expand Down

0 comments on commit c09cd4a

Please sign in to comment.