Skip to content

Commit

Permalink
Fix spacing and recursive calls
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Feb 16, 2024
1 parent 3e7f27a commit c7df05e
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions system/jlib/jlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,15 +1285,15 @@ void LogMsgPrepender::report(const LogMsgCategory & cat, const char * format, ..
buff.append(file).append("(").append(line).append(") : ").append(format);
va_list args;
va_start(args, format);
queryLogMsgManager()->report_va(cat, buff.str(), args);
queryLogMsgManager()->report_va(cat, buff.str(), args);
va_end(args);
}

void LogMsgPrepender::report_va(const LogMsgCategory & cat, const char * format, va_list args)
{
StringBuffer buff;
buff.append(file).append("(").append(line).append(") : ").append(format);
queryLogMsgManager()->report_va(cat, buff.str(), args);
queryLogMsgManager()->report_va(cat, buff.str(), args);
}

void LogMsgPrepender::report(const LogMsgCategory & cat, LogMsgCode code, const char * format, ...)
Expand All @@ -1302,15 +1302,15 @@ void LogMsgPrepender::report(const LogMsgCategory & cat, LogMsgCode code, const
buff.append(file).append("(").append(line).append(") : ").append(format);
va_list args;
va_start(args, format);
queryLogMsgManager()->report_va(cat, buff.str(), args);
queryLogMsgManager()->report_va(cat, buff.str(), args);
va_end(args);
}

void LogMsgPrepender::report_va(const LogMsgCategory & cat, LogMsgCode code, const char * format, va_list args)
{
StringBuffer buff;
buff.append(file).append("(").append(line).append(") : ").append(format);
queryLogMsgManager()->report_va(cat, buff.str(), args);
queryLogMsgManager()->report_va(cat, buff.str(), args);
}

void LogMsgPrepender::report(const LogMsgCategory & cat, const IException * exception, const char * prefix)
Expand All @@ -1319,12 +1319,12 @@ void LogMsgPrepender::report(const LogMsgCategory & cat, const IException * exce
buff.append(file).append("(").append(line).append(") : ");
if(prefix) buff.append(prefix).append(" : ");
exception->errorMessage(buff);
queryLogMsgManager()->report(cat, exception->errorCode(), "%s", buff.str());
queryLogMsgManager()->report(cat, exception->errorCode(), "%s", buff.str());
}

IException * LogMsgPrepender::report(IException * e, const char * prefix, LogMsgClass cls)
{
report(MCexception(e, cls), e, prefix);
report(MCexception(e, cls), e, prefix);
return e;
}

Expand Down Expand Up @@ -1525,29 +1525,29 @@ void CLogMsgManager::report(const LogMsgCategory & cat, const char * format, ...
if(rejectsCategory(cat)) return;
va_list args;
va_start(args, format);
pushMsg(new LogMsg(cat, getNextID(), NoLogMsgCode, format, args, port, session));
pushMsg(new LogMsg(cat, getNextID(), NoLogMsgCode, format, args, port, session));
va_end(args);
}

void CLogMsgManager::report_va(const LogMsgCategory & cat, const char * format, va_list args)
{
if(rejectsCategory(cat)) return;
pushMsg(new LogMsg(cat, getNextID(), NoLogMsgCode, format, args, port, session));
pushMsg(new LogMsg(cat, getNextID(), NoLogMsgCode, format, args, port, session));
}

void CLogMsgManager::report(const LogMsgCategory & cat, LogMsgCode code, const char * format, ...)
{
if(rejectsCategory(cat)) return;
va_list args;
va_start(args, format);
pushMsg(new LogMsg(cat, getNextID(), code, format, args, port, session));
pushMsg(new LogMsg(cat, getNextID(), code, format, args, port, session));
va_end(args);
}

void CLogMsgManager::report_va(const LogMsgCategory & cat, LogMsgCode code, const char * format, va_list args)
{
if(rejectsCategory(cat)) return;
pushMsg(new LogMsg(cat, getNextID(), code, format, args, port, session));
pushMsg(new LogMsg(cat, getNextID(), code, format, args, port, session));
}

void CLogMsgManager::mreport_direct(const LogMsgCategory & cat, const char * msg)
Expand Down Expand Up @@ -1593,7 +1593,7 @@ void CLogMsgManager::report(const LogMsgCategory & cat, const IException * excep
StringBuffer buff;
if(prefix) buff.append(prefix).append(" : ");
exception->errorMessage(buff);
pushMsg(new LogMsg(cat, getNextID(), exception->errorCode(), buff.str(), port, session));
pushMsg(new LogMsg(cat, getNextID(), exception->errorCode(), buff.str(), port, session));
}

void CLogMsgManager::pushMsg(LogMsg * _msg)
Expand Down Expand Up @@ -3339,31 +3339,39 @@ void ctxlogReport(const LogMsgCategory & cat, const char * format, ...)
{
va_list args;
va_start(args, format);
ctxlogReportVA(cat, NoLogMsgCode, format, args);
ctxlogReportVA(cat, NoLogMsgCode, format, args);
va_end(args);
}

void ctxlogReportVA(const LogMsgCategory & cat, const char * format, va_list args)
{
ctxlogReportVA(cat, NoLogMsgCode, format, args);
ctxlogReportVA(cat, NoLogMsgCode, format, args);
}
void ctxlogReport(const LogMsgCategory & cat, LogMsgCode code, const char * format, ...)
{
va_list args;
va_start(args, format);
ctxlogReportVA(cat, code, format, args);
ctxlogReportVA(cat, code, format, args);
va_end(args);
}
void ctxlogReportVA(const LogMsgCategory & cat, LogMsgCode code, const char * format, va_list args)
{
ctxlogReportVA(cat, code, format, args);
if (default_thread_logctx)
{
LogContextScope ls(nullptr);
ls.prev->CTXLOGva(cat, code, format, args);
}
else
queryLogMsgManager()->report_va(cat, code, format, args);
}
void ctxlogReport(const LogMsgCategory & cat, const IException * e, const char * prefix)
{
ctxlogReport(cat, e, prefix);
StringBuffer buff;
e->errorMessage(buff);
ctxlogReport(cat, e->errorCode(), "%s%s%s", prefix ? prefix : "", prefix ? prefix : " : ", buff.str());
}
IException * ctxlogReport(IException * e, const char * prefix, LogMsgClass cls)
{
ctxlogReport(MCexception(e, cls), e, prefix);
ctxlogReport(MCexception(e, cls), e, prefix);
return e;
}

0 comments on commit c7df05e

Please sign in to comment.