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.
| 1235 | |
| 1236 | |
| 1237 | class _StderrHandler(StreamHandler): |
| 1238 | """ |
| 1239 | This class is like a StreamHandler using sys.stderr, but always uses |
| 1240 | whatever sys.stderr is currently set to rather than the value of |
| 1241 | sys.stderr at handler construction time. |
| 1242 | """ |
| 1243 | def __init__(self, level=NOTSET): |
| 1244 | """ |
| 1245 | Initialize the handler. |
| 1246 | """ |
| 1247 | Handler.__init__(self, level) |
| 1248 | |
| 1249 | @property |
| 1250 | def stream(self): |
| 1251 | return sys.stderr |
| 1252 | |
| 1253 | |
| 1254 | _defaultLastResort = _StderrHandler(WARNING) |