| 242 | ]) |
| 243 | |
| 244 | def test_nested_explicit(self): |
| 245 | # Logging levels in a nested namespace, all explicitly set. |
| 246 | m = self.next_message |
| 247 | |
| 248 | INF = logging.getLogger("INF") |
| 249 | INF.setLevel(logging.INFO) |
| 250 | INF_ERR = logging.getLogger("INF.ERR") |
| 251 | INF_ERR.setLevel(logging.ERROR) |
| 252 | |
| 253 | # These should log. |
| 254 | INF_ERR.log(logging.CRITICAL, m()) |
| 255 | INF_ERR.error(m()) |
| 256 | |
| 257 | # These should not log. |
| 258 | INF_ERR.warning(m()) |
| 259 | INF_ERR.info(m()) |
| 260 | INF_ERR.debug(m()) |
| 261 | |
| 262 | self.assert_log_lines([ |
| 263 | ('INF.ERR', 'CRITICAL', '1'), |
| 264 | ('INF.ERR', 'ERROR', '2'), |
| 265 | ]) |
| 266 | |
| 267 | def test_nested_inherited(self): |
| 268 | # Logging levels in a nested namespace, inherited from parent loggers. |