File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ def emit(self, record: LogRecord) -> None:
179
179
180
180
raise NotImplementedError ()
181
181
182
+ def flush (self ) -> None :
183
+ """Placeholder for flush function in subclasses."""
184
+
182
185
183
186
# pylint: disable=too-few-public-methods
184
187
class StreamHandler (Handler ):
@@ -206,6 +209,12 @@ def emit(self, record: LogRecord) -> None:
206
209
"""
207
210
self .stream .write (self .format (record ) + self .terminator )
208
211
212
+ def flush (self ) -> None :
213
+ """flush the stream. You might need to call this if your messages
214
+ are not appearing in the log file.
215
+ """
216
+ self .stream .flush ()
217
+
209
218
210
219
class FileHandler (StreamHandler ):
211
220
"""File handler for working with log files off of the microcontroller (like
@@ -239,6 +248,7 @@ def emit(self, record: LogRecord) -> None:
239
248
:param record: The record (message object) to be logged
240
249
"""
241
250
self .stream .write (self .format (record ))
251
+ self .stream .flush ()
242
252
243
253
244
254
class RotatingFileHandler (FileHandler ):
@@ -338,6 +348,7 @@ def emit(self, record: LogRecord) -> None:
338
348
):
339
349
self .doRollover ()
340
350
self .stream .write (self .format (record ))
351
+ self .stream .flush ()
341
352
342
353
343
354
class NullHandler (Handler ):
You can’t perform that action at this time.
0 commit comments