Skip to content
Snippets Groups Projects
Verified Commit bdac8bda authored by Martin Stump's avatar Martin Stump
Browse files

Replace pragma once with include guards


Signed-off-by: default avatarMartin Stump <martin.stump@mercedes-benz.com>
parent 0689f387
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment