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