summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2020-04-29 17:30:06 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-18 20:23:42 +0000
commitbab691491a8db3419dab5ecd79689d5357f1e0cc (patch)
treee3c2255daf44f3dfa96b96957b71855890c42e56
parenteafd8199cbd90915088c505e75810de7b4d52f90 (diff)
downloadmongo-bab691491a8db3419dab5ecd79689d5357f1e0cc.tar.gz
SERVER-46933 reformat the json startupWarnings
-rw-r--r--src/mongo/shell/utils.js33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 9ae58f3910c..d3a2e32e55f 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -862,6 +862,8 @@ shellHelper.show = function(what) {
what = args[0];
args = args.splice(1);
+ var messageIndent = " ";
+
if (what == "profile") {
if (db.system.profile.count() == 0) {
print("db.system.profile is empty");
@@ -1013,10 +1015,27 @@ shellHelper.show = function(what) {
if (res.log.length == 0) {
return "";
}
- print("Server has startup warnings: ");
+ print("---");
+ print("The server generated these startup warnings when booting: ");
for (var i = 0; i < res.log.length; i++) {
- print(res.log[i]);
+ var logOut;
+ try {
+ var parsedLog = JSON.parse(res.log[i]);
+ var linePrefix = messageIndent + parsedLog.t["$date"] + ": ";
+ logOut = linePrefix + parsedLog.msg + "\n";
+ if (parsedLog.attr) {
+ for (var attr in parsedLog.attr) {
+ logOut += linePrefix + messageIndent + attr + ": " +
+ parsedLog.attr[attr] + "\n";
+ }
+ }
+ } catch (err) {
+ // err is intentionally unused here
+ logOut = res.log[i];
+ }
+ print(logOut);
}
+ print("---");
return "";
} else if (res.errmsg == "no such cmd: getLog") {
// Don't print if the command is not available
@@ -1089,15 +1108,19 @@ shellHelper.show = function(what) {
print("---");
} else if (freemonStatus.state === 'undecided') {
print(
- "---\n" +
+ "---\n" + messageIndent +
"Enable MongoDB's free cloud-based monitoring service, which will then receive and display\n" +
+ messageIndent +
"metrics about your deployment (disk utilization, CPU, operation statistics, etc).\n" +
- "\n" +
+ "\n" + messageIndent +
"The monitoring data will be available on a MongoDB website with a unique URL accessible to you\n" +
+ messageIndent +
"and anyone you share the URL with. MongoDB may use this information to make product\n" +
+ messageIndent +
"improvements and to suggest MongoDB products and deployment options to you.\n" +
- "\n" +
+ "\n" + messageIndent +
"To enable free monitoring, run the following command: db.enableFreeMonitoring()\n" +
+ messageIndent +
"To permanently disable this reminder, run the following command: db.disableFreeMonitoring()\n" +
"---\n");
}