Clean spdlog.cpp added assert

This commit is contained in:
gabime 2024-12-06 15:27:13 +02:00
parent 7c44647d99
commit 03e9aacf11

View File

@ -2,6 +2,7 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
#include <memory> #include <memory>
#include <cassert>
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
#include "spdlog/common.h" #include "spdlog/common.h"
@ -30,7 +31,10 @@ void set_global_logger(std::shared_ptr<logger> global_logger) {
context()->set_logger(std::move(global_logger)); context()->set_logger(std::move(global_logger));
} }
logger *global_logger_raw() noexcept { return context_ref()->global_logger_raw(); } logger *global_logger_raw() noexcept {
assert(context_ref()->global_logger_raw() != nullptr);
return context_ref()->global_logger_raw();
}
void set_formatter(std::unique_ptr<formatter> formatter) { void set_formatter(std::unique_ptr<formatter> formatter) {
global_logger()->set_formatter(std::move(formatter)); global_logger()->set_formatter(std::move(formatter));