Skip to content

Commit

Permalink
HPCC-30413 rollback unintentional release of jlog csv change
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Oct 4, 2023
1 parent 7891c69 commit a8290db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 82 deletions.
81 changes: 2 additions & 79 deletions system/jlib/jlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion system/jlib/jlog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions system/jlib/jlog.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a8290db

Please sign in to comment.