Skip to content

Commit 273db5b

Browse files
committed
Make it easier to enable logs while running tests.
1 parent 7bb18a6 commit 273db5b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import logging
2+
import os
23

34

4-
# Avoid displaying stack traces at the ERROR logging level.
5-
logging.basicConfig(level=logging.CRITICAL)
5+
format = "%(asctime)s %(levelname)s %(name)s %(message)s"
6+
7+
if bool(os.environ.get("WEBSOCKETS_DEBUG")): # pragma: no cover
8+
# Display every frame sent or received in debug mode.
9+
level = logging.DEBUG
10+
else:
11+
# Hide stack traces of exceptions.
12+
level = logging.CRITICAL
13+
14+
logging.basicConfig(format=format, level=level)

0 commit comments

Comments
 (0)