diff --git a/server/routes/user.py b/server/routes/user.py index 0644818a..536a4256 100644 --- a/server/routes/user.py +++ b/server/routes/user.py @@ -170,11 +170,13 @@ def log_mood(): if not mood or not activities: return jsonify({"message": "Missing data for mood or activities"}), 400 + # Example logging statement using datetime correctly + logging.info(f"Logging mood for {current_user} at {datetime.now()}") + mood_log.log_user_mood(current_user, mood, activities) return jsonify({"message": "Mood logged successfully"}), 200 - # Example logging statement using datetime correctly - logging.info(f"Logging mood for {current_user} at {datetime.now()}") + except Exception as e: logging.error(f"Error logging mood: {str(e)}") diff --git a/server/services/db/mood_log.py b/server/services/db/mood_log.py index cb718cc7..a16ae440 100644 --- a/server/services/db/mood_log.py +++ b/server/services/db/mood_log.py @@ -1,5 +1,5 @@ import logging -import datetime +from datetime import datetime from pymongo.errors import PyMongoError from services.azure_mongodb import MongoDBClient