def log_message(self, format, *args):
        """
        overrides the ``log_message`` method from the wsgiref server so that
        normal logging works with whatever configuration the application has
        been set to.

        Levels are inferred from the HTTP status code, 4XX codes are treated as
        warnings, 5XX as errors and everything else as INFO level.
        """
        code = args[1][0]
        levels = {
            '4': 'warning',
            '5': 'error'
        }

        log_handler = getattr(logger, levels.get(code, 'info'))
        log_handler(args % format)
dataset/ETHPy150Open pecan/pecan/pecan/commands/serve.py/PecanWSGIRequestHandler.log_message/swapped operands of `%`