Emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emit. If stream is not open, current mode is 'w' and `_closed=True`, record will not be emitted (see Issue #42378).
(self, record)
| 1214 | encoding=self.encoding, errors=self.errors) |
| 1215 | |
| 1216 | def emit(self, record): |
| 1217 | """ |
| 1218 | Emit a record. |
| 1219 | |
| 1220 | If the stream was not opened because 'delay' was specified in the |
| 1221 | constructor, open it before calling the superclass's emit. |
| 1222 | |
| 1223 | If stream is not open, current mode is 'w' and `_closed=True`, record |
| 1224 | will not be emitted (see Issue #42378). |
| 1225 | """ |
| 1226 | if self.stream is None: |
| 1227 | if self.mode != 'w' or not self._closed: |
| 1228 | self.stream = self._open() |
| 1229 | if self.stream: |
| 1230 | StreamHandler.emit(self, record) |
| 1231 | |
| 1232 | def __repr__(self): |
| 1233 | level = getLevelName(self.level) |