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)
| 1249 | encoding=self.encoding, errors=self.errors) |
| 1250 | |
| 1251 | def emit(self, record): |
| 1252 | """ |
| 1253 | Emit a record. |
| 1254 | |
| 1255 | If the stream was not opened because 'delay' was specified in the |
| 1256 | constructor, open it before calling the superclass's emit. |
| 1257 | |
| 1258 | If stream is not open, current mode is 'w' and `_closed=True`, record |
| 1259 | will not be emitted (see Issue #42378). |
| 1260 | """ |
| 1261 | if self.stream is None: |
| 1262 | if self.mode != 'w' or not self._closed: |
| 1263 | self.stream = self._open() |
| 1264 | if self.stream: |
| 1265 | StreamHandler.emit(self, record) |
| 1266 | |
| 1267 | def __repr__(self): |
| 1268 | level = getLevelName(self.level) |