summaryrefslogtreecommitdiff
path: root/src/mongo/logger/log_severity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/logger/log_severity.cpp')
-rw-r--r--src/mongo/logger/log_severity.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/logger/log_severity.cpp b/src/mongo/logger/log_severity.cpp
index ca60f7cdab9..576aab14cee 100644
--- a/src/mongo/logger/log_severity.cpp
+++ b/src/mongo/logger/log_severity.cpp
@@ -59,6 +59,26 @@ namespace {
return StringData(unknownSeverityString, StringData::LiteralTag());
}
+ char LogSeverity::toChar() const {
+ if (_severity > 0)
+ return 'D';
+ // 'S' might be confused with "Success"
+ // Return 'F' to imply Fatal instead.
+ if (*this == LogSeverity::Severe())
+ return 'F';
+ if (*this == LogSeverity::Error())
+ return 'E';
+ if (*this == LogSeverity::Warning())
+ return 'W';
+ if (*this == LogSeverity::Info())
+ return 'I';
+ if (*this == LogSeverity::Log())
+ return 'I';
+ // Should not reach here - returning 'U' for Unknown severity
+ // to be consistent with toStringData().
+ return 'U';
+ }
+
std::ostream& operator<<(std::ostream& os, LogSeverity severity) {
return os << severity.toStringData();
}