This class is like a StreamHandler using sys.stderr, but always uses whatever sys.stderr is currently set to rather than the value of sys.stderr at handler construction time.
| 1270 | |
| 1271 | |
| 1272 | class _StderrHandler(StreamHandler): |
| 1273 | """ |
| 1274 | This class is like a StreamHandler using sys.stderr, but always uses |
| 1275 | whatever sys.stderr is currently set to rather than the value of |
| 1276 | sys.stderr at handler construction time. |
| 1277 | """ |
| 1278 | def __init__(self, level=NOTSET): |
| 1279 | """ |
| 1280 | Initialize the handler. |
| 1281 | """ |
| 1282 | Handler.__init__(self, level) |
| 1283 | |
| 1284 | @property |
| 1285 | def stream(self): |
| 1286 | return sys.stderr |
| 1287 | |
| 1288 | |
| 1289 | _defaultLastResort = _StderrHandler(WARNING) |