diff options
author | Abseil Team <absl-team@google.com> | 2018-01-31T01·39-0800 |
---|---|---|
committer | jueminyang <jueminyang@google.com> | 2018-01-31T15·17-0500 |
commit | 8a401394b8f71da745b3ad6e7c783d7f13ef5428 (patch) | |
tree | 9fc7cb3a8d986a1e551183d9fe3c2b11aec972a9 /absl/base/log_severity.h | |
parent | f4f238b09bc365e355ce404d02c7d7fd02662597 (diff) |
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
Diffstat (limited to 'absl/base/log_severity.h')
-rw-r--r-- | absl/base/log_severity.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/base/log_severity.h b/absl/base/log_severity.h index deaf6a578925..e026665eb650 100644 --- a/absl/base/log_severity.h +++ b/absl/base/log_severity.h @@ -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" |