We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74e6dd0 commit abdb6dfCopy full SHA for abdb6df
src/cs50/sql.py
@@ -1,14 +1,19 @@
1
def _enable_logging(f):
2
+ """Enable logging of SQL statements when Flask is in use."""
3
+
4
import logging
5
import functools
6
7
@functools.wraps(f)
8
def decorator(*args, **kwargs):
9
10
+ # Infer whether Flask is installed
11
try:
12
import flask
13
except ModuleNotFoundError:
14
return f(*args, **kwargs)
15
16
+ # Enable logging
17
disabled = logging.getLogger("cs50").disabled
18
if flask.current_app:
19
logging.getLogger("cs50").disabled = False
0 commit comments