about summary refs log tree commit diff
path: root/absl/base/log_severity.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/base/log_severity.h')
-rw-r--r--absl/base/log_severity.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/absl/base/log_severity.h b/absl/base/log_severity.h
index e146bcb05a49..e2931c34d1df 100644
--- a/absl/base/log_severity.h
+++ b/absl/base/log_severity.h
@@ -22,6 +22,9 @@
 
 namespace absl {
 
+// Four severity levels are defined.  Logging APIs should terminate the program
+// when a message is logged at severity `kFatal`; the other levels have no
+// special semantics.
 enum class LogSeverity : int {
   kInfo = 0,
   kWarning = 1,
@@ -36,6 +39,8 @@ constexpr std::array<absl::LogSeverity, 4> LogSeverities() {
            absl::LogSeverity::kError, absl::LogSeverity::kFatal}};
 }
 
+// Returns the all-caps std::string representation (e.g. "INFO") of the specified
+// severity level if it is one of the normal levels and "UNKNOWN" otherwise.
 constexpr const char* LogSeverityName(absl::LogSeverity s) {
   return s == absl::LogSeverity::kInfo
              ? "INFO"
@@ -46,7 +51,8 @@ constexpr const char* LogSeverityName(absl::LogSeverity s) {
                          : s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
 }
 
-// Note that out-of-range severities normalize to kInfo or kError, never kFatal.
+// Values less than `kInfo` normalize to `kInfo`; values greater than `kFatal`
+// normalize to `kError` (**NOT** `kFatal`).
 constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
   return s < absl::LogSeverity::kInfo
              ? absl::LogSeverity::kInfo