diff --git a/mwclient/__init__.py b/mwclient/__init__.py index bb32ddeb99a5a011f9c7ada974eccb54df7a6b51..3f85dc1605e90f57e7f876796454541216f1519f 100644 --- a/mwclient/__init__.py +++ b/mwclient/__init__.py @@ -26,3 +26,14 @@ from errors import * from client import Site, __ver__ import ex + +# Logging: Add a null handler to avoid "No handler found" warnings. +import logging +try: + from logging import NullHandler +except ImportError: + class NullHandler(logging.Handler): + def emit(self, record): + pass + +logging.getLogger(__name__).addHandler(NullHandler())