MCPcopy Index your code
hub / github.com/python/cpython / setStream

Method setStream

Lib/logging/__init__.py:1164–1179  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)

Callers 1

test_stream_settingMethod · 0.95

Calls 1

flushMethod · 0.95

Tested by 1

test_stream_settingMethod · 0.76