Skip to content

v0.2.52..v0.2.53 changeset LogGeneric.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/util/LogGeneric.cpp b/hoot-core/src/main/cpp/hoot/core/util/LogGeneric.cpp
index 3e06dd1..58a1445 100644
--- a/hoot-core/src/main/cpp/hoot/core/util/LogGeneric.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/util/LogGeneric.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 #include "Log.h"
@@ -111,18 +111,32 @@ bool Log::notFiltered(const string& prettyFunction)
     return true;
   }
 
-  // split arguments from function call name
-  QStringList nameParts = QString::fromStdString(prettyFunction).split("(");
-  if (nameParts.length() < 1) return true;
+  const QString prettyFunctionQt = QString::fromStdString(prettyFunction);
+  if (!prettyFunctionQt.endsWith(".js"))    // call from C++
+  {
+    // split arguments from function call name
+    QStringList nameParts = prettyFunctionQt.split("(");
+    if (nameParts.length() < 1) return true;
+
+    // split class name from function name
+    nameParts = nameParts[0].split("::");
+    const int listLen = nameParts.length();
+
+    // Is there any way we can throw here if the class name isn't recognized, so we don't wonder
+    // why a typo caused us not to get the logging we thought we were going to get?
 
-  // split class name from function name
-  nameParts = nameParts[0].split("::");
-  int listLen = nameParts.length();
+    return (listLen > 1 && _classFilter.contains(nameParts[listLen - 2]));
+  }
+  else  // call from a JS generic conflate script
+  {
+    // split arguments from script path
+    const QStringList nameParts = prettyFunctionQt.split("/");
+    if (nameParts.length() < 1) return true;
 
-  // Is there any way we can throw here if the class name isn't recognized, so we don't wonder
-  // why a typo caused us not to get the logging we thought we were going to get?
+    const QString scriptName = nameParts[nameParts.size() - 1];
 
-  return (listLen > 1 && _classFilter.contains(nameParts[listLen - 2]));
+    return _classFilter.contains(scriptName);
+  }
 }
 
 void Log::setLevel(WarningLevel l)
Clone this wiki locally