/*
 * Copyright (C) 2024-present ScyllaDB
 */

/*
 * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
 */

#include <seastar/core/on_internal_error.hh>
#include <seastar/util/log.hh>
#include <seastar/core/format.hh>

#include "on_internal_error.hh"

static seastar::logger on_internal_error_logger("on_internal_error");

namespace utils {

[[noreturn]] void on_internal_error(std::string_view reason) {
    seastar::on_internal_error(on_internal_error_logger, reason);
}

[[noreturn]] void on_fatal_internal_error(std::string_view reason) noexcept {
    seastar::on_fatal_internal_error(on_internal_error_logger, reason);
}

[[noreturn]] void __assert_fail_on_internal_error(const char* expr, const char* file, int line, const char* function) {
    on_internal_error(fmt::format("Assertion '{}' failed at {}:{} in {}",
        expr, file, line, function));
}

} // namespace utils
