def _get_formatter(self, config: Dict[str, Any]) -> logging.Formatter:
        """Returns a logging formatter based on the type of logger in the given configuration.

        :param config: ``log`` section from Patroni configuration.

        :returns: A :class:`logging.Formatter` object that can be used to format log records.
        """
        logtype = config.get('type', PatroniLogger.DEFAULT_TYPE)
        logformat: type_logformat = config.get('format', PatroniLogger.DEFAULT_FORMAT)
        dateformat = config.get('dateformat') or None  # Convert empty string to `None`
        static_fields = config.get('static_fields', {})

        if dateformat is not None and not isinstance(dateformat, str):
            _LOGGER.warning('Expected log dateformat to be a string, but got "%s"', _type(dateformat))
            dateformat = None

        if logtype == 'json':
            formatter = self._get_json_formatter(logformat, dateformat, static_fields)
        else:
            formatter = self._get_plain_formatter(logformat, dateformat)

        return formatter
Returns a logging formatter based on the type of logger in the given configuration.

        :param config: ``log`` section from Patroni configuration.

        :returns: A :class:`logging.Formatter` object that can be used to format log records.
        
patroni/log.py