Browse Source

HPCC-23505 Change append()/set() in CTxSummary

Move the LogLevel to the 3rd place in one append()/set() to match
with other append()/set(). Also default logLevel to LogMax.

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 5 years ago
parent
commit
a4874e99e6
2 changed files with 9 additions and 7 deletions
  1. 2 2
      esp/platform/espcontext.cpp
  2. 7 5
      esp/platform/txsummary.hpp

+ 2 - 2
esp/platform/espcontext.cpp

@@ -517,7 +517,7 @@ public:
     virtual void addTraceSummaryTimeStamp(LogLevel logLevel, const char *name)
     {
         if (m_txSummary && !isEmptyString(name))
-            m_txSummary->append(name, m_txSummary->getElapsedTime(), "ms", TokenSerializer(), logLevel);
+            m_txSummary->append(name, m_txSummary->getElapsedTime(), logLevel, "ms");
     }
     virtual void flushTraceSummary()
     {
@@ -525,7 +525,7 @@ public:
         if (m_txSummary)
         {
             m_txSummary->set("auth", authStatus.get(), LogMin);
-            m_txSummary->append("total", m_processingTime, "ms", TokenSerializer(), LogMin);
+            m_txSummary->append("total", m_processingTime, LogMin, "ms");
         }
     }
     virtual void addTraceSummaryCumulativeTime(LogLevel logLevel, const char* name, unsigned __int64 time)

+ 7 - 5
esp/platform/txsummary.hpp

@@ -59,14 +59,14 @@ public:
     // false if the key is NULL, empty, or not unique within the summary.
     virtual bool append(const char* key, const char* value, const LogLevel logLevel = LogMin);
     template <typename TValue, typename TSuffix = const char*, class TSerializer = TokenSerializer>
-    bool append(const char* key, const TValue& value, const TSuffix& suffix = "", const TSerializer& serializer = TSerializer(), const LogLevel logLevel = LogMin);
+    bool append(const char* key, const TValue& value, const LogLevel logLevel = LogMin, const TSuffix& suffix = "", const TSerializer& serializer = TSerializer());
 
     // Updates the value associated with an existing key, or appends the key
     // and value to the summary if it is not already found. Returns false if
     // the key is NULL or empty. Returns true otherwise.
     virtual bool set(const char* key, const char* value, const LogLevel logLevel = LogMin);
     template <typename TValue, typename TSuffix = const char*, class TSerializer = TokenSerializer>
-    bool set(const char* key, const TValue& value, const TSuffix& suffix = "", const TSerializer& serializer = TSerializer(), const LogLevel logLevel = LogMin);
+    bool set(const char* key, const TValue& value, const LogLevel logLevel = LogMin, const TSuffix& suffix = "", const TSerializer& serializer = TSerializer());
 
     void log(const LogLevel logLevel);
 
@@ -91,7 +91,9 @@ private:
     {
         StringAttr key;
         StringAttr value;
-        LogLevel logLevel;
+        LogLevel logLevel = LogMax;
+
+        Entry(const char* _key, const char* _value, const LogLevel _logLevel) : key(_key), value(_value), logLevel(_logLevel) {}
     };
 
     using Entries = std::list<Entry>;
@@ -108,7 +110,7 @@ private:
 
 // Convenience wrapper of the default append method.
 template <typename TValue, typename TSuffix, class TSerializer>
-inline bool CTxSummary::append(const char* key, const TValue& value, const TSuffix& suffix, const TSerializer& serializer, const LogLevel logLevel)
+inline bool CTxSummary::append(const char* key, const TValue& value, const LogLevel logLevel, const TSuffix& suffix, const TSerializer& serializer)
 {
     StringBuffer buffer;
     serializer.serialize(value, buffer);
@@ -118,7 +120,7 @@ inline bool CTxSummary::append(const char* key, const TValue& value, const TSuff
 
 // Convenience wrapper of the default set method.
 template <typename TValue, typename TSuffix, class TSerializer>
-inline bool CTxSummary::set(const char* key, const TValue& value, const TSuffix& suffix, const TSerializer& serializer, const LogLevel logLevel)
+inline bool CTxSummary::set(const char* key, const TValue& value, const LogLevel logLevel, const TSuffix& suffix, const TSerializer& serializer)
 {
     StringBuffer buffer;
     serializer.serialize(value, buffer);