Skip to content

Commit

Permalink
Make it easier to enable logs while running tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Aug 5, 2024
1 parent 7bb18a6 commit 0885485
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import logging
import os


# Avoid displaying stack traces at the ERROR logging level.
logging.basicConfig(level=logging.CRITICAL)
format = "%(asctime)s %(levelname)s %(name)s %(message)s"

if bool(os.environ.get("WEBSOCKETS_DEBUG")):
# Display every frame sent or received in debug mode.
level = logging.DEBUG
else:
# Hide stack traces of exceptions.
level = logging.CRITICAL

logging.basicConfig(format=format, level=level)

0 comments on commit 0885485

Please sign in to comment.