def METHOD_NAME(func, start=None):
    level = 0
    current_frame = None
    # Increase the current level for each traced function in the stackframe
    # This way we can visualize the call stack.
    for frame, _ in traceback.walk_stack(None):
        current_frame = current_frame if current_frame is not None else frame
        func_name = frame.f_code.co_name
        if func_name in _trace_funcs:
            level += 1
    # We can assume we have 'args' because we only call _log_trace inside
    # trace or TraceDispatcher.register
    current_op = current_frame.f_locals["args"][0]
    # If the first argument is a Expr, we print its op because it's more
    # informative.
    if isinstance(current_op, ir.Expr):
        current_op = current_op.op()
    _logger.debug(
        "%s %s %s %s",
        "  " * level,
        func.__name__,
        type(current_op).__qualname__,
        f"{datetime.now() - start}" if start else "",
    )