log_referral(Operation *op)
{
    int internal_op;

    internal_op = operation_is_flag_set(op, OP_FLAG_INTERNAL);

    if (!internal_op) {
        slapi_log_access(LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
                         op->o_connid, op->o_opid);
    } else {
        if (config_get_accesslog_level() & LDAP_DEBUG_STATS2) {
            uint64_t connid;
            int32_t op_id;
            int32_t op_internal_id;
            int32_t op_nested_count;
            get_internal_conn_op(&connid, &op_id, &op_internal_id, &op_nested_count);
            slapi_log_access(LDAP_DEBUG_ARGS,
                             connid == 0 ? "conn=Internal(%" PRIu64 ") op=%d(%d)(%d) REFERRAL\n" :
                                           "conn=%" PRIu64 " (Internal) op=%d(%d)(%d) REFERRAL\n",
                             connid, op_id, op_internal_id, op_nested_count);
        }
    }
}
log_referral(Operation *op)
{
    int internal_op;

    internal_op = operation_is_flag_set(op, OP_FLAG_INTERNAL);

    if (!internal_op) {
        slapi_log_access(LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
                         op->o_connid, op->o_opid);
    } else {
        if (config_get_accesslog_level() & LDAP_DEBUG_STATS2) {
            uint64_t connid;
            int32_t op_id;
            int32_t op_internal_id;
            int32_t op_nested_count;
            get_internal_conn_op(&connid, &op_id, &op_internal_id, &op_nested_count);
            slapi_log_access(LDAP_DEBUG_ARGS,
                             connid == 0 ? "conn=Internal(%" PRIu64 ") op=%d(%d)(%d) REFERRAL\n" :
                                           "conn=%" PRIu64 " (Internal) op=%d(%d)(%d) REFERRAL\n",
                             connid, op_id, op_internal_id, op_nested_count);
        }
    }
}