human
I wrote the below code

    calls = []
    def replacement(msg, *args, **kwargs):
        call = (msg % args)
        calls.append(((call, kwargs) if log_kwargs else call))
    logger = logging.getLogger(logger_name)
    orig = getattr(logger, log_level)
    setattr(logger, log_level, replacement)
    try:
        (yield calls)
    finally:
        setattr(logger, log_level, orig)

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

@contextmanager
def patch_logger(logger_name, log_level, log_kwargs=False):