def METHOD_NAME(func, instance, args, kwargs):
    # Get the LogRecord instance for this log
    record = func(*args, **kwargs)
    setattr(record, RECORD_ATTR_VERSION, config.version or "")
    setattr(record, RECORD_ATTR_ENV, config.env or "")
    setattr(record, RECORD_ATTR_SERVICE, config.service or "")
    # logs from internal logger may explicitly pass the current span to
    # avoid deadlocks in getting the current span while already in locked code.
    span_from_log = getattr(record, _LOG_SPAN_KEY, None)
    if isinstance(span_from_log, ddtrace.Span):
        span = span_from_log
    else:
        span = _get_current_span(tracer=config.logging.tracer)
    if span:
        trace_id = span.trace_id
        if config._128_bit_trace_id_enabled and not config._128_bit_trace_id_logging_enabled:
            trace_id = span._trace_id_64bits
        setattr(record, RECORD_ATTR_TRACE_ID, str(trace_id))
        setattr(record, RECORD_ATTR_SPAN_ID, str(span.span_id))
    else:
        setattr(record, RECORD_ATTR_TRACE_ID, RECORD_ATTR_VALUE_ZERO)
        setattr(record, RECORD_ATTR_SPAN_ID, RECORD_ATTR_VALUE_ZERO)
    return record