Skip to content

Commit 535719e

Browse files
cfsmp3claude
authored andcommitted
fix: Use current_app.logger instead of g.log
g.log is only available during HTTP requests (set in before_request), but current_app.logger works in any app context including tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 3087b2c commit 535719e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mod_health/controllers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from datetime import datetime
44
from typing import Any, Dict, Tuple
55

6-
from flask import Blueprint, current_app, g, jsonify
6+
from flask import Blueprint, current_app, jsonify
77

88
mod_health = Blueprint('health', __name__)
99

@@ -22,8 +22,8 @@ def check_database() -> Dict[str, Any]:
2222
# remove() returns the scoped session's connection to the pool
2323
db.remove()
2424
return {'status': 'ok'}
25-
except Exception as e:
26-
g.log.exception('Health check database connection failed')
25+
except Exception:
26+
current_app.logger.exception('Health check database connection failed')
2727
return {'status': 'error', 'message': 'Database connection failed'}
2828

2929

0 commit comments

Comments
 (0)