def METHOD_NAME(log_cb=None):
    def _log_call(*lines):
        _log(lines, prefix=" ", stream="call")
    def _log_stdout(*lines):
        _log(lines, prefix=">", stream="stdout")
    def _log_stderr(*lines):
        _log(lines, prefix="!", stream="stderr")
    def _log(lines, prefix=None, stream=None):
        if log_cb is None:
            return
        log_cb(lines, prefix=prefix, stream=stream)
    caller = CommandlineCaller()
    if log_cb is not None:
        caller.on_log_call = _log_call
        caller.on_log_stdout = _log_stdout
        caller.on_log_stderr = _log_stderr
    return caller