Remove _log_exc workaround and NullHandler

It was added back in bfc408b probably due to a misunderstanding of
https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library.

The default behaviour of logging WARNING and above is good and
desirable (hiding unhandled exceptions in update handlers by default
was a big, accidental mistake). NullHandler is used to *prevent*
this good default, so it shouldn't be used in the first place.
This commit is contained in:
Lonami Exo
2021-02-02 20:47:02 +01:00
parent 9a0e030db8
commit 0997e3fa9f
2 changed files with 6 additions and 16 deletions

View File

@@ -25,8 +25,7 @@ DEFAULT_PORT = 443
if typing.TYPE_CHECKING:
from .telegramclient import TelegramClient
__default_log__ = logging.getLogger(__base_name__)
__default_log__.addHandler(logging.NullHandler())
_base_log = logging.getLogger(__base_name__)
# In seconds, how long to wait before disconnecting a exported sender.
@@ -246,7 +245,7 @@ class TelegramBaseClient(abc.ABC):
if isinstance(base_logger, str):
base_logger = logging.getLogger(base_logger)
elif not isinstance(base_logger, logging.Logger):
base_logger = __default_log__
base_logger = _base_log
class _Loggers(dict):
def __missing__(self, key):