Logging changes
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m39s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m30s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 5m47s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 5m39s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m20s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 7m14s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 7m11s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m19s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m14s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m19s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m21s
Bigfoot / Clang Format Checks (push) Failing after 11s
Some checks failed
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 5m39s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 5m30s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 5m47s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 5m39s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m20s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Failing after 7m14s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Failing after 7m11s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 6m19s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 6m14s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Successful in 7m19s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Successful in 7m21s
Bigfoot / Clang Format Checks (push) Failing after 11s
This commit is contained in:
@@ -2,4 +2,6 @@ get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName}Tests)
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
"")
|
||||
"")
|
||||
|
||||
bigfoot_create_logger()
|
||||
@@ -0,0 +1,21 @@
|
||||
// AUTO-GENERATED DO NOT TOUCH
|
||||
|
||||
/*********************************************************************
|
||||
* \file UtilsTestsLogger.generated.hpp
|
||||
*
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILSTESTSLOGGER_GENERATED_HPP
|
||||
#define BIGFOOT_UTILSTESTSLOGGER_GENERATED_HPP
|
||||
#include <Utils/Log/LogMacros.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
inline Log::LoggerInfo UTILSTESTS_LOGGER {"UTILSTESTS_LOGGER", Flat::LogLevel::Trace};
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <Utils/Singleton.hpp>
|
||||
|
||||
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -39,60 +41,57 @@ class LogFixture: public ::testing::Test
|
||||
|
||||
return Flat::LogLevel::Trace;
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
Singleton<Log>::GetInstance().UnregisterLogger(m_logger);
|
||||
}
|
||||
|
||||
Log::LoggerInfo m_logger {"LOGGER", Flat::LogLevel::Trace};
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, RegisterLogger_ShouldRegisterTheLogger)
|
||||
{
|
||||
const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(m_logger);
|
||||
const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
|
||||
EXPECT_TRUE(logger);
|
||||
EXPECT_EQ(logger, Singleton<Log>::GetInstance().GetLogger(m_logger));
|
||||
EXPECT_EQ(logger->get_logger_name(), m_logger.m_name);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), m_logger.m_level);
|
||||
EXPECT_EQ(logger, Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER));
|
||||
EXPECT_EQ(logger->get_logger_name(), UTILSTESTS_LOGGER.m_name);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), UTILSTESTS_LOGGER.m_level);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, UnregisterLogger_ShouldUnregisterTheLogger)
|
||||
{
|
||||
std::ignore = Singleton<Log>::GetInstance().RegisterLogger(m_logger);
|
||||
Singleton<Log>::GetInstance().UnregisterLogger(m_logger);
|
||||
std::ignore = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
|
||||
Singleton<Log>::GetInstance().UnregisterLogger(UTILSTESTS_LOGGER);
|
||||
|
||||
EXPECT_EQ(Singleton<Log>::GetInstance().GetLogger(m_logger), nullptr);
|
||||
EXPECT_EQ(Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER), nullptr);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, GetLogger_ShouldReturnNullptrIfTheLoggerDoesNotExist)
|
||||
{
|
||||
EXPECT_FALSE(Singleton<Log>::GetInstance().GetLogger(m_logger));
|
||||
EXPECT_FALSE(Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, GetLogger_ShouldReturnTheLoggerIfItExists)
|
||||
TEST_F(LogFixture, GetLoger_ShouldReturnTheLoggerIfItExists)
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(m_logger);
|
||||
EXPECT_TRUE(Singleton<Log>::GetInstance().GetLogger(m_logger));
|
||||
const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
|
||||
EXPECT_TRUE(Singleton<Log>::GetInstance().GetLogger(UTILSTESTS_LOGGER));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogFixture, ChangeLoggerLogLevel_ShouldChangeTheLoggerLogLevel)
|
||||
{
|
||||
const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(m_logger);
|
||||
const Flat::LogLevel previous = UTILSTESTS_LOGGER.m_level;
|
||||
|
||||
Singleton<Log>::GetInstance().ChangeLoggerLogLevel(m_logger, Flat::LogLevel::Critical);
|
||||
const quill::Logger* logger = Singleton<Log>::GetInstance().RegisterLogger(UTILSTESTS_LOGGER);
|
||||
|
||||
Singleton<Log>::GetInstance().ChangeLoggerLogLevel(UTILSTESTS_LOGGER, Flat::LogLevel::Critical);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), Flat::LogLevel::Critical);
|
||||
Singleton<Log>::GetInstance().ChangeLoggerLogLevel(UTILSTESTS_LOGGER, previous);
|
||||
EXPECT_EQ(QuillLogLevelToLogLevel(logger->get_log_level()), previous);
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*********************************************************************/
|
||||
#include <Utils/Log/LogMacros.hpp>
|
||||
|
||||
#include <UtilsTests/UtilsTestsLogger_generated.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -15,54 +17,48 @@ namespace Bigfoot
|
||||
class LogMacrosFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void TearDown() override
|
||||
{
|
||||
Singleton<Log>::GetInstance().UnregisterLogger(m_logger);
|
||||
}
|
||||
|
||||
Log::LoggerInfo m_logger {"LOGGER", Flat::LogLevel::Trace};
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogMacrosFixture, LogDebug)
|
||||
{
|
||||
BIGFOOT_LOG_DEBUG(m_logger, "Hello");
|
||||
BIGFOOT_LOG_DEBUG(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogMacrosFixture, LogTrace)
|
||||
{
|
||||
BIGFOOT_LOG_TRACE(m_logger, "Hello");
|
||||
BIGFOOT_LOG_TRACE(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogMacrosFixture, LogInfo)
|
||||
{
|
||||
BIGFOOT_LOG_INFO(m_logger, "Hello");
|
||||
BIGFOOT_LOG_INFO(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogMacrosFixture, LogWarn)
|
||||
{
|
||||
BIGFOOT_LOG_WARN(m_logger, "Hello");
|
||||
BIGFOOT_LOG_WARN(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogMacrosFixture, LogError)
|
||||
{
|
||||
BIGFOOT_LOG_ERROR(m_logger, "Hello");
|
||||
BIGFOOT_LOG_ERROR(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(LogMacrosFixture, LogFatal)
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(m_logger, "Hello");
|
||||
BIGFOOT_LOG_FATAL(UTILSTESTS_LOGGER, "Hello");
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user