From a8290db17e2062c2fcf5c37989aaf1bd2403550b Mon Sep 17 00:00:00 2001 From: Jake Smith Date: Wed, 4 Oct 2023 10:04:10 +0100 Subject: [PATCH] HPCC-30413 rollback unintentional release of jlog csv change Signed-off-by: Jake Smith --- system/jlib/jlog.cpp | 81 ++------------------------------------------ system/jlib/jlog.hpp | 1 - system/jlib/jlog.ipp | 4 +-- 3 files changed, 4 insertions(+), 82 deletions(-) diff --git a/system/jlib/jlog.cpp b/system/jlib/jlog.cpp index ba237000813..8e44015fb6d 100644 --- a/system/jlib/jlog.cpp +++ b/system/jlib/jlog.cpp @@ -671,83 +671,6 @@ StringBuffer & LogMsg::toStringTable(StringBuffer & out, unsigned fields) const return out; } -StringBuffer & LogMsg::toStringCSV(StringBuffer & out, unsigned fields) const -{ - if(fields & MSGFIELD_msgID) - out.appendf("%08X,", sysInfo.queryMsgID()); - out.ensureCapacity(LOG_MSG_FORMAT_BUFFER_LENGTH); - if(fields & MSGFIELD_audience) - out.appendf("%s,", LogMsgAudienceToFixString(category.queryAudience())); - if(fields & MSGFIELD_class) - out.appendf("%s,", LogMsgClassToFixString(category.queryClass())); - if(fields & MSGFIELD_detail) - out.appendf("%d,", category.queryDetail()); - if(fields & MSGFIELD_timeDate) - { - time_t timeNum = sysInfo.queryTime(); - char timeString[12]; - struct tm timeStruct; - localtime_r(&timeNum, &timeStruct); - if(fields & MSGFIELD_date) - { - strftime(timeString, 12, "%Y-%m-%d,", &timeStruct); - out.append(timeString); - } - if(fields & MSGFIELD_microTime) - { - out.appendf("%02d:%02d:%02d.%06d,", timeStruct.tm_hour, timeStruct.tm_min, timeStruct.tm_sec, sysInfo.queryUSecs()); - } - else if(fields & MSGFIELD_milliTime) - { - out.appendf("%02d:%02d:%02d.%03d,", timeStruct.tm_hour, timeStruct.tm_min, timeStruct.tm_sec, sysInfo.queryUSecs()/1000); - } - else if(fields & MSGFIELD_time) - { - strftime(timeString, 12, "%H:%M:%S,", &timeStruct); - out.append(timeString); - } - } - if(fields & MSGFIELD_process) - out.appendf("%d,",sysInfo.queryProcessID()); - if(fields & MSGFIELD_thread) - out.appendf("%d,",sysInfo.queryThreadID()); - if(fields & MSGFIELD_session) - { - if(sysInfo.querySessionID() == UnknownSession) - out.append("unknown"); - else - out.appendf("%" I64F "u,", sysInfo.querySessionID()); - } - if(fields & MSGFIELD_node) - { - sysInfo.queryNode()->getUrlStr(out).append(','); - } - if(fields & MSGFIELD_job) - { - out.appendf("%s,", jobInfo.queryJobIDStr()); - } - if(fields & MSGFIELD_user) - { - if(jobInfo.queryUserID() == UnknownUser) - out.append("unknown,"); - else - out.appendf("%" I64F "u,", jobInfo.queryUserID()); - } - if (fields & MSGFIELD_quote) - out.append('"'); - if (fields & MSGFIELD_prefix) - out.append(msgPrefix(category.queryClass())); - if((fields & MSGFIELD_code) && (msgCode != NoLogMsgCode)) - out.append(msgCode).append(": ").append(text.str()); - else - out.append(text.str()); - if (fields & MSGFIELD_quote) - out.append('"'); - out.append('\n'); - return out; -} - - StringBuffer & LogMsg::toStringTableHead(StringBuffer & out, unsigned fields) { loggingFieldColumns.generateHeaderRow(out, fields, false).append("\n\n"); @@ -956,7 +879,7 @@ void CategoryLogMsgFilter::reset() void HandleLogMsgHandlerTable::handleMessage(const LogMsg & msg) { CriticalBlock block(crit); - msg.toStringCSV(curMsgText.clear(), messageFields); + msg.toStringTable(curMsgText.clear(), messageFields); fputs(curMsgText.str(), handle); } @@ -1053,7 +976,7 @@ FileLogMsgHandler::~FileLogMsgHandler() void FileLogMsgHandlerTable::handleMessage(const LogMsg & msg) { CriticalBlock block(crit); - msg.toStringCSV(curMsgText.clear(), messageFields); + msg.toStringTable(curMsgText.clear(), messageFields); fputs(curMsgText.str(), handle); if(flushes) fflush(handle); diff --git a/system/jlib/jlog.hpp b/system/jlib/jlog.hpp index b2f376e6ae2..cfb7692af02 100644 --- a/system/jlib/jlog.hpp +++ b/system/jlib/jlog.hpp @@ -588,7 +588,6 @@ class jlib_decl LogMsg : public CInterface StringBuffer & toStringXML(StringBuffer & out, unsigned fields) const; StringBuffer & toStringJSON(StringBuffer & out, unsigned fields) const; StringBuffer & toStringTable(StringBuffer & out, unsigned fields) const; - StringBuffer & toStringCSV(StringBuffer & out, unsigned fields) const; static StringBuffer & toStringTableHead(StringBuffer & out, unsigned fields); static void fprintTableHead(FILE * handle, unsigned fields); inline const LogMsgCategory queryCategory() const { return category; } diff --git a/system/jlib/jlog.ipp b/system/jlib/jlog.ipp index 0c4040564a5..bfd06cb5f21 100644 --- a/system/jlib/jlog.ipp +++ b/system/jlib/jlog.ipp @@ -587,9 +587,9 @@ public: printHeader = false; } if (currentLogFields) // If appending to existing log file, use same format as existing - msg.toStringCSV(curMsgText.clear(), currentLogFields); + msg.toStringTable(curMsgText.clear(), currentLogFields); else - msg.toStringCSV(curMsgText.clear(), messageFields); + msg.toStringTable(curMsgText.clear(), messageFields); fputs(curMsgText.str(), handle); if(flushes) fflush(handle);