diff --git a/include/MantleAPI/Common/i_logger.h b/include/MantleAPI/Common/i_logger.h index 37d8efa0e8dc73f66acb6f310de14f3692e32ba1..7aac56249e33ea5a664609c577efd8af1f0e5692 100644 --- a/include/MantleAPI/Common/i_logger.h +++ b/include/MantleAPI/Common/i_logger.h @@ -8,7 +8,8 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -#pragma once +#ifndef MANTLEAPI_COMMON_I_LOGGER_H +#define MANTLEAPI_COMMON_I_LOGGER_H #include <string_view> @@ -64,3 +65,5 @@ public: }; } // namespace mantle_api + +#endif // MANTLEAPI_COMMON_I_LOGGER_H diff --git a/include/MantleAPI/Common/log_utils.h b/include/MantleAPI/Common/log_utils.h index 7d005692307f0099e81bafef25452b62cd46a2bc..843142378e45806d4e57ea53bd1b24f37df5f950 100644 --- a/include/MantleAPI/Common/log_utils.h +++ b/include/MantleAPI/Common/log_utils.h @@ -8,11 +8,13 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -#pragma once +#ifndef MANTLEAPI_COMMON_LOG_UTILS_H +#define MANTLEAPI_COMMON_LOG_UTILS_H #include <MantleAPI/Common/i_logger.h> #include <array> +#include <ostream> #include <string_view> namespace mantle_api @@ -23,13 +25,13 @@ namespace log_utils static inline constexpr auto kLogLevelNames = std::array<std::string_view, 6>{"Trace", "Debug", "Info", "Warning", "Error", "Critical"}; -[[nodiscard]] inline constexpr auto ToStringView(LogLevel level) noexcept -> std::string_view +[[nodiscard]] constexpr auto ToStringView(LogLevel level) noexcept -> std::string_view { return (level >= LogLevel::kTrace && level <= LogLevel::kCritical) ? kLogLevelNames.at(static_cast<size_t>(level)) : "Log level out of range"; } template <LogLevel Level> -[[nodiscard]] inline constexpr auto ToStringView() noexcept -> std::string_view +[[nodiscard]] constexpr auto ToStringView() noexcept -> std::string_view { static_assert(Level >= LogLevel::kTrace && Level <= LogLevel::kCritical, "Log level out of range"); return ToStringView(Level); @@ -44,3 +46,5 @@ inline auto operator<<(std::ostream& os, mantle_api::LogLevel level) noexcept -> } } // namespace mantle_api + +#endif // MANTLEAPI_COMMON_LOG_UTILS_H diff --git a/test/MantleAPI/Common/mock_logger.h b/test/MantleAPI/Common/mock_logger.h index 546489e25962ed544d41da2127b7f486113db327..958a31f5894b9fec2a384db479a4277a19ad3821 100644 --- a/test/MantleAPI/Common/mock_logger.h +++ b/test/MantleAPI/Common/mock_logger.h @@ -8,12 +8,13 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -#pragma once +#ifndef MANTLEAPI_COMMON_MOCK_LOGGER_H +#define MANTLEAPI_COMMON_MOCK_LOGGER_H #include <gmock/gmock.h> #include <iomanip> -#include <iostream> +#include <ostream> #include "MantleAPI/Common/i_logger.h" #include "MantleAPI/Common/log_utils.h" @@ -41,3 +42,5 @@ public: }; } // namespace mantle_api + +#endif // MANTLEAPI_COMMON_MOCK_LOGGER_H