Skip to content

Commit

Permalink
logger: use newer, more robust IRC connection check
Browse files Browse the repository at this point in the history
The revamped `connection_registered` bot property checks for a backend,
a socket connection, AND connection registration. This is what we need
to prevent doing a `say()` before the IRC connection is ready.
  • Loading branch information
dgw committed Feb 11, 2023
1 parent 4c3e45e commit d6b4231
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sopel/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def emit(self, record):
:param record: the log record to output
:type record: :class:`logging.LogRecord`
"""
if self._bot.backend is None or not self._bot.backend.is_connected():
# Don't emit logs when the bot is not connected.
if not self._bot.connection_registered:
# Don't emit logs to IRC when the bot is not connected & registered.
return

try:
Expand Down

0 comments on commit d6b4231

Please sign in to comment.