Files
clio/tests/common/util/LoggerFixtures.hpp
2026-03-24 15:25:32 +00:00

39 lines
686 B
C++

#pragma once
#include "util/LoggerBuffer.hpp"
#include <gtest/gtest.h>
#include <string>
/**
* @brief A fixture for testing LogService and Logger.
*/
class LoggerFixture : virtual public ::testing::Test {
protected:
LoggerBuffer buffer_;
public:
LoggerFixture();
~LoggerFixture() override;
/**
* @brief Sets up spdlog loggers for each channel. Should be called once before using any
* loggers. Simulates the `util::LogService::init(config)` call
*/
static void
init();
protected:
[[nodiscard]]
std::string
getLoggerString()
{
return buffer_.getStrAndReset();
}
private:
void
resetTestingLoggers();
};