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