ConstantCoder commited on
Commit
2355fff
·
verified ·
1 Parent(s): 9e433d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
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
- with open(log_file_path, 'a') as f:
19
- f.write(f"{action_log}\n")
 
 
 
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__':