(self)
| 42 | self.notify_subscribers(message_with_timestamp) |
| 43 | |
| 44 | def flush(self): |
| 45 | with self.lock: |
| 46 | if self.buffer: |
| 47 | line = self.buffer.strip() |
| 48 | if line: |
| 49 | timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') |
| 50 | message_with_timestamp = f"{timestamp} - {line}\n" |
| 51 | self.stdout.write(message_with_timestamp) |
| 52 | self.file.write(message_with_timestamp) |
| 53 | self.notify_subscribers(message_with_timestamp) |
| 54 | self.buffer = "" |
| 55 | self.stdout.flush() |
| 56 | self.file.flush() |
| 57 | |
| 58 | def close(self): |
| 59 | with self.lock: |
no test coverage detected