diff options
Diffstat (limited to 'src/mongo/scripting/engine.cpp')
-rw-r--r-- | src/mongo/scripting/engine.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index 77017f455ae..fb18a034226 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -40,6 +40,7 @@ #include "mongo/client/dbclient_cursor.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" +#include "mongo/logv2/log.h" #include "mongo/scripting/dbdirectclient_factory.h" #include "mongo/util/fail_point.h" #include "mongo/util/file.h" @@ -137,7 +138,7 @@ bool Scope::execFile(const string& filename, bool printResult, bool reportError, boost::filesystem::path p(filename); #endif if (!exists(p)) { - error() << "file [" << filename << "] doesn't exist"; + LOGV2_ERROR(22779, "file [{filename}] doesn't exist", "filename"_attr = filename); return false; } @@ -156,7 +157,9 @@ bool Scope::execFile(const string& filename, bool printResult, bool reportError, } if (empty) { - error() << "directory [" << filename << "] doesn't have any *.js files"; + LOGV2_ERROR(22780, + "directory [{filename}] doesn't have any *.js files", + "filename"_attr = filename); return false; } @@ -171,7 +174,7 @@ bool Scope::execFile(const string& filename, bool printResult, bool reportError, fileofs fo = f.len(); if (fo > kMaxJsFileLength) { - warning() << "attempted to execute javascript file larger than 2GB"; + LOGV2_WARNING(22778, "attempted to execute javascript file larger than 2GB"); return false; } unsigned len = static_cast<unsigned>(fo); @@ -258,8 +261,10 @@ void Scope::loadStored(OperationContext* opCtx, bool ignoreNotConnected) { throw; } - error() << "unable to load stored JavaScript function " << n.valuestr() - << "(): " << redact(setElemEx); + LOGV2_ERROR(22781, + "unable to load stored JavaScript function {n_valuestr}(): {setElemEx}", + "n_valuestr"_attr = n.valuestr(), + "setElemEx"_attr = redact(setElemEx)); } } @@ -339,7 +344,7 @@ public: if (scope->hasOutOfMemoryException()) { // make some room - log() << "Clearing all idle JS contexts due to out of memory"; + LOGV2(22777, "Clearing all idle JS contexts due to out of memory"); _pools.clear(); return; } |