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