We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e0c2f3 commit 18a4a3dCopy full SHA for 18a4a3d
adafruit_logging.py
@@ -179,6 +179,9 @@ def emit(self, record: LogRecord) -> None:
179
180
raise NotImplementedError()
181
182
+ def flush(self) -> None:
183
+ """Placeholder for flush function in subclasses."""
184
+
185
186
# pylint: disable=too-few-public-methods
187
class StreamHandler(Handler):
@@ -415,6 +418,13 @@ def getEffectiveLevel(self) -> int:
415
418
416
419
return self._level
417
420
421
+ def flushHandlers(self) -> None:
422
+ """Flush all handlers. This will ensure that all data is immediately written to the streams.
423
+ This can be useful if you need to make sure the log is written before a reset.
424
+ """
425
+ for handlerName in self._handlers:
426
+ handlerName.flush()
427
428
def addHandler(self, hdlr: Handler) -> None:
429
"""Adds the handler to this logger.
430
0 commit comments