summaryrefslogtreecommitdiff
path: root/src/mongo/logger/log_component.h
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-07-16 12:35:13 -0400
committerBenety Goh <benety@mongodb.com>2014-07-29 17:42:21 -0400
commitc91a2c3392fc95be3ed07ba98a4d98b4db754b58 (patch)
tree255115ae0f8391766ca75441b30225f6a4194d34 /src/mongo/logger/log_component.h
parenta0dcb4026b3f1171b4124e2666cf71460d023bb1 (diff)
downloadmongo-c91a2c3392fc95be3ed07ba98a4d98b4db754b58.tar.gz
SERVER-4217 updated detailed log format to include log severity and component name.
Log severity is logged with a single capital letter. F - Severe E - Error W - Warning I - Info and Debug Level 0 D - All debug levels > 0 Component name is logged in upper-case padded with trailing spaces to fit within 8 characters.
Diffstat (limited to 'src/mongo/logger/log_component.h')
-rw-r--r--src/mongo/logger/log_component.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/logger/log_component.h b/src/mongo/logger/log_component.h
index 01cf100d725..0fcd0c3e95d 100644
--- a/src/mongo/logger/log_component.h
+++ b/src/mongo/logger/log_component.h
@@ -27,8 +27,11 @@
#pragma once
+#include <iosfwd>
#include <string>
+#include "mongo/base/string_data.h"
+
namespace mongo {
namespace logger {
@@ -66,6 +69,11 @@ namespace logger {
LogComponent parent() const;
/**
+ * Returns short name as a StringData.
+ */
+ StringData toStringData() const;
+
+ /**
* Returns short name of log component.
* Used to generate server parameter names in the format "logLevel_<component short name>".
*/
@@ -78,9 +86,18 @@ namespace logger {
*/
std::string getDottedName() const;
+ /**
+ * Returns name suitable for inclusion in formatted log message.
+ * This is derived from upper-casing the short name with some padding to
+ * fit into a fixed length field.
+ */
+ StringData getNameForLog() const;
+
private:
Value _value;
};
+ std::ostream& operator<<(std::ostream& os, LogComponent component);
+
} // namespace logger
} // namespace mongo