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

Use std::size_t for array size


Signed-off-by: default avatarMartin Stump <martin.stump@mercedes-benz.com>
parent c5657f03
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
#include <MantleAPI/Common/i_logger.h>
#include <array>
#include <cstddef>
#include <ostream>
#include <string_view>
......@@ -23,11 +24,11 @@ namespace mantle_api
namespace log_utils
{
static inline constexpr auto kLogLevelNames = std::array<std::string_view, 6>{"Trace", "Debug", "Info", "Warning", "Error", "Critical"};
static inline constexpr auto kLogLevelNames = std::array<std::string_view, 6U>{"Trace", "Debug", "Info", "Warning", "Error", "Critical"};
[[nodiscard]] constexpr std::string_view ToStringView(LogLevel level) noexcept
{
return (level >= LogLevel::kTrace && level <= LogLevel::kCritical) ? kLogLevelNames.at(static_cast<size_t>(level)) : "Log level out of range";
return (level >= LogLevel::kTrace && level <= LogLevel::kCritical) ? kLogLevelNames.at(static_cast<std::size_t>(level)) : "Log level out of range";
}
} // namespace log_utils
......
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