summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/base/log_severity.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/base/log_severity.h b/absl/base/log_severity.h
index deaf6a57..e026665e 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"