Changes imported from Abseil "staging" branch:

- 93fb81f991e9079769aa28381426f318a1c64377 Add an iterable container of valid absl::LogSeverity valu... by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 93fb81f991e9079769aa28381426f318a1c64377
Change-Id: I63d2c6fe6865f5f92a2260368c58585bc994b5e4
This commit is contained in:
Abseil Team 2018-01-30 17:39:47 -08:00 committed by jueminyang
parent f4f238b09b
commit 8a401394b8

View file

@ -16,6 +16,8 @@
#ifndef ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
#define ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
#include <array>
#include "absl/base/attributes.h"
namespace absl {
@ -27,6 +29,13 @@ enum class LogSeverity : int {
kFatal = 3,
};
// Returns an iterable of all standard `absl::LogSeverity` values, ordered from
// least to most severe.
constexpr std::array<absl::LogSeverity, 4> LogSeverities() {
return {{absl::LogSeverity::kInfo, absl::LogSeverity::kWarning,
absl::LogSeverity::kError, absl::LogSeverity::kFatal}};
}
constexpr const char* LogSeverityName(absl::LogSeverity s) {
return s == absl::LogSeverity::kInfo
? "INFO"