Skip to content

Commit

Permalink
add log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlu1248 committed Jun 23, 2024
1 parent 29c803b commit 27ee015
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sweepai/chat/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ async def write_message_to_disk(
}
with open(f"{CACHE_DIRECTORY}/messages/{message_id}.json", "w") as file:
json.dump(data, file)
logger.info(f"Saved {len(messages)} messages to {message_id}.json")
return {"status": "success", "message": "Message written to disk successfully.", "message_id": message_id}
except Exception as e:
logger.error(f"Failed to write message to disk: {str(e)}")
Expand All @@ -1203,6 +1204,7 @@ async def read_message_from_disk(
try:
with open(f"{CACHE_DIRECTORY}/messages/{message_id}.json", "r") as file:
message_data = json.load(file)
logger.info(f"Loaded {len(message_data['messages'])} messages from {message_id}.json")
return {
"status": "success",
"message": "Message read from disk successfully.",
Expand Down

0 comments on commit 27ee015

Please sign in to comment.