Skip to content

Commit a43b565

Browse files
committedJun 7, 2022
scoping INFO and ERROR to FLASK_ENV=development
1 parent 9540ec3 commit a43b565

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="9.1.0"
19+
version="9.2.0"
2020
)

‎src/cs50/sql.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def _enable_logging(f):
99

1010
import logging
1111
import functools
12+
import os
1213

1314
@functools.wraps(f)
1415
def decorator(*args, **kwargs):
@@ -19,9 +20,9 @@ def decorator(*args, **kwargs):
1920
except ModuleNotFoundError:
2021
return f(*args, **kwargs)
2122

22-
# Enable logging
23+
# Enable logging in development mode
2324
disabled = logging.getLogger("cs50").disabled
24-
if flask.current_app:
25+
if flask.current_app and os.getenv("FLASK_ENV") == "development":
2526
logging.getLogger("cs50").disabled = False
2627
try:
2728
return f(*args, **kwargs)

0 commit comments

Comments
 (0)
Please sign in to comment.