docs: def init_logger(logger_name='sip', log_level=None, p3_mode: bool = True,
                  show_thread: bool = False, propagate: bool = False,
                  show_log_origin=False):
      """Initialise the SIP logger.
  
      Attaches a stdout stream handler to the 'sip' logger. This will
      apply to all logger objects with a name prefixed by 'sip.'
  
      This function respects the 'SIP_LOG_LEVEL' environment variable to
      set the logging level.
  
      Args:
          logger_name (str, optional): Name of the logger object.
          log_level (str or int, optional): Logging level for the SIP logger.
          p3_mode (bool, optional): Print logging statements in a format that
              P3 can support.
          show_thread (bool, optional): Display the thread in the log message.
          propagate (bool, optional): Propagate settings to parent loggers.
          show_log_origin (boo, optional): If true show the origin
              (file, line no.) of log messages.
  
      """
      log = logging.getLogger(logger_name)
      log.propagate = propagate
  
      # Remove existing handlers (avoids duplicate messages)
      for handler in log.handlers:
          log.removeHandler(handler)
  
      _debug = '%(filename)s:%(lineno)d | ' if show_log_origin else ''
  
      # P3 mode is intended to work with the fluentd configuration on P3.
      # This has ms timestamp precision and uses '-' as a delimiter
      # between statements in the log file.
      if p3_mode:
          _prefix = '%(asctime)s - %(name)s - %(levelname)s'
          if show_thread:
              _format = '{} - %(threadName)s - {}%(message)s'\
                  .format(_prefix, _debug)
          else:
              _format = '{} - {}%(message)s'.format(_prefix, _debug)
          formatter = logging.Formatter(_format)
          formatter.converter = time.gmtime
      # If not in P3 mode, the timestamp will be us precision and use '|'
      # as a separator.
      else:
          _prefix = '%(asctime)s | %(name)s | %(levelname)s'
          if show_thread:
              _format = '{} | %(threadName)s | {}%(message)s'\
                  .format(_prefix, _debug)
          else:
              _format = '{} | {}%(message)s'.format(_prefix, _debug)
          formatter = SIPFormatter(_format, datefmt='%Y-%m-%dT%H:%M:%S.%fZ')
  
      handler = logging.StreamHandler(stream=sys.stdout)
      handler.setFormatter(formatter)
      log.addHandler(handler)
  
      # Set the logging level.
      if log_level:
          log.setLevel(log_level)
      else:
          log.setLevel(os.getenv('SIP_LOG_LEVEL', 'DEBUG'))