Skip to content

Commit 01359e7

Browse files
committed
allow the handler exceptions to propagate
1 parent 134605a commit 01359e7

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

adafruit_logging.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ def _level_for(value: int) -> str:
140140
- ``args`` - The additional positional arguments provided
141141
"""
142142

143-
# Whether to print exceptions caught during handler's emit().
144-
printHandlerExceptions = True
145-
146143

147144
def _logRecordFactory(name, level, msg, args):
148145
return LogRecord(name, level, _level_for(level), msg, time.monotonic(), args)
@@ -341,13 +338,7 @@ def handle(self, record: LogRecord) -> None:
341338
if record.levelno >= self._level:
342339
for handler in self._handlers:
343340
if record.levelno >= handler.level:
344-
try:
345-
handler.emit(record)
346-
except Exception as e: # pylint: disable=broad-except
347-
if sys.stderr and printHandlerExceptions:
348-
sys.stderr.write(
349-
f"Handler {handler} produced exception: {e}\n"
350-
)
341+
handler.emit(record)
351342

352343
def log(self, level: int, msg: str, *args) -> None:
353344
"""Log a message.

0 commit comments

Comments
 (0)