get_logger#

wattson.util.log.get_logger(host_name: str, logger_name: str | None = None, level: int = 20, active_contexts: Iterable[str] | None = None, use_context_logger: bool = False, use_basic_logger: bool = True, use_fake_logger: bool = False, syslog_config: bool | Dict = False) Logger | ContextLogger | AsyncLogger | BasicLogger#

Overwrites logging.get_logger to make it compatible with the ContextLogger

Parameters:
  • host_name (str) – Host the logger is attaching to

  • logger_name (Optional[str], optional) – more specific log name (Default value = None)

  • level (int, optional) – logging-level (INFO) (Default value = logging.INFO)

  • active_contexts (Optional[Iterable[str]], optional) – contexts enabled by default (for context-logger)

  • use_context_logger (bool, optional) – True to use a ContextLogger (Default value = False)

  • use_basic_logger (bool, optional) – True to use BasicLogger as the wrapper (Default value = True)

  • use_fake_logger (bool, optional) – True to disable actual logging (Default value = False)

  • syslog_config (Union[bool, Dict], optional) – A dictionary defining the syslog behavior - address: Tuple[string, int] (Address & Port) (localhost, SYSLOG_UDP_PORT) or socket file (“/dev/log”) - facility: syslog facility (LOG_DAEMON) - socket_type: socket type (socket.SOCK_DGRAM) If set to True, syslog is enabled with default parameters. If set to False, syslog is disabled

Returns:

new ContextLogger/logging.Logger