Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream.
(self, record)
| 1140 | self.stream.flush() |
| 1141 | |
| 1142 | def emit(self, record): |
| 1143 | """ |
| 1144 | Emit a record. |
| 1145 | |
| 1146 | If a formatter is specified, it is used to format the record. |
| 1147 | The record is then written to the stream with a trailing newline. If |
| 1148 | exception information is present, it is formatted using |
| 1149 | traceback.print_exception and appended to the stream. If the stream |
| 1150 | has an 'encoding' attribute, it is used to determine how to do the |
| 1151 | output to the stream. |
| 1152 | """ |
| 1153 | try: |
| 1154 | msg = self.format(record) |
| 1155 | stream = self.stream |
| 1156 | # issue 35046: merged two stream.writes into one. |
| 1157 | stream.write(msg + self.terminator) |
| 1158 | self.flush() |
| 1159 | except RecursionError: # See issue 36272 |
| 1160 | raise |
| 1161 | except Exception: |
| 1162 | self.handleError(record) |
| 1163 | |
| 1164 | def setStream(self, stream): |
| 1165 | """ |
nothing calls this directly
no test coverage detected