fix: prevent posthog from sending errors to stderr (#4008)

This commit is contained in:
Julian Risch 2023-01-31 11:02:47 +01:00 committed by GitHub
parent 2b1849f525
commit c855e18d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,8 +31,11 @@ user_id: Optional[str] = None
logger = logging.getLogger(__name__)
# disable posthog logging
logging.getLogger("posthog").setLevel(CRITICAL)
logging.getLogger("backoff").setLevel(CRITICAL)
for module_name in ["posthog", "backoff"]:
logging.getLogger(module_name).setLevel(CRITICAL)
# Prevent module from sending errors to stderr when an exception is encountered during an emit() call
logging.getLogger(module_name).addHandler(logging.NullHandler())
logging.getLogger(module_name).propagate = False
class TelemetryFileType(Enum):