| 473 | |
| 474 | @validate("log") |
| 475 | def _validate_log(self, proposal: Bunch) -> LoggerType: |
| 476 | if not isinstance(proposal.value, (logging.Logger, logging.LoggerAdapter)): |
| 477 | # warn about unsupported type, but be lenient to allow for duck typing |
| 478 | warnings.warn( |
| 479 | f"{self.__class__.__name__}.log should be a Logger or LoggerAdapter," |
| 480 | f" got {proposal.value}.", |
| 481 | UserWarning, |
| 482 | stacklevel=2, |
| 483 | ) |
| 484 | return t.cast(LoggerType, proposal.value) |
| 485 | |
| 486 | @default("log") |
| 487 | def _log_default(self) -> LoggerType: |