MCPcopy Create free account
hub / github.com/ipython/traitlets / _get_log_handler

Method _get_log_handler

traitlets/config/configurable.py:495–511  ·  view source on GitHub ↗

Return the default Handler Returns None if none can be found Deprecated, this now returns the first log handler which may or may not be the default one.

(self)

Source from the content-addressed store, hash-verified

493 return log.get_logger()
494
495 def _get_log_handler(self) -> logging.Handler | None:
496 """Return the default Handler
497
498 Returns None if none can be found
499
500 Deprecated, this now returns the first log handler which may or may
501 not be the default one.
502 """
503 if not self.log:
504 return None
505 logger: logging.Logger = (
506 self.log if isinstance(self.log, logging.Logger) else self.log.logger
507 )
508 if not getattr(logger, "handlers", None):
509 # no handlers attribute or empty handlers list
510 return None
511 return logger.handlers[0]
512
513
514CT = t.TypeVar("CT", bound="SingletonConfigurable")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected