Update app.py
Browse files
app.py
CHANGED
@@ -15,8 +15,11 @@ def static_files(path):
|
|
15 |
def log_action():
|
16 |
action_log = request.get_json()
|
17 |
log_file_path = os.path.join(app.root_path, 'user_actions.json')
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
return jsonify({"status": "success"}), 200
|
21 |
|
22 |
if __name__ == '__main__':
|
|
|
15 |
def log_action():
|
16 |
action_log = request.get_json()
|
17 |
log_file_path = os.path.join(app.root_path, 'user_actions.json')
|
18 |
+
try:
|
19 |
+
with open(log_file_path, 'a') as f:
|
20 |
+
f.write(f"{action_log}\n")
|
21 |
+
except Exception as e:
|
22 |
+
print(f"Error writing to log file: {e}")
|
23 |
return jsonify({"status": "success"}), 200
|
24 |
|
25 |
if __name__ == '__main__':
|