(self, s)
| 20 | return f"<SystemLog (level {self.buffer.level})>" |
| 21 | |
| 22 | def write(self, s): |
| 23 | if not isinstance(s, str): |
| 24 | raise TypeError( |
| 25 | f"write() argument must be str, not {type(s).__name__}") |
| 26 | |
| 27 | # In case `s` is a str subclass that writes itself to stdout or stderr |
| 28 | # when we call its methods, convert it to an actual str. |
| 29 | s = str.__str__(s) |
| 30 | |
| 31 | # We want to emit one log message per line, so split |
| 32 | # the string before sending it to the superclass. |
| 33 | for line in s.splitlines(keepends=True): |
| 34 | super().write(line) |
| 35 | |
| 36 | return len(s) |
| 37 | |
| 38 | |
| 39 | class LogStream(io.RawIOBase): |
nothing calls this directly
no test coverage detected