Sets the StreamHandler's stream to the specified value, if it is different. Returns the old stream, if the stream was changed, or None if it wasn't.
(self, stream)
| 1162 | self.handleError(record) |
| 1163 | |
| 1164 | def setStream(self, stream): |
| 1165 | """ |
| 1166 | Sets the StreamHandler's stream to the specified value, |
| 1167 | if it is different. |
| 1168 | |
| 1169 | Returns the old stream, if the stream was changed, or None |
| 1170 | if it wasn't. |
| 1171 | """ |
| 1172 | if stream is self.stream: |
| 1173 | result = None |
| 1174 | else: |
| 1175 | result = self.stream |
| 1176 | with self.lock: |
| 1177 | self.flush() |
| 1178 | self.stream = stream |
| 1179 | return result |
| 1180 | |
| 1181 | def __repr__(self): |
| 1182 | level = getLevelName(self.level) |