mirror of https://github.com/AxioDL/logvisor.git
Fix va_list clobbering
Adjust FileLogger output to match ConsoleLogger output
This commit is contained in:
parent
e7478c5bb4
commit
448c56e37b
|
@ -146,7 +146,12 @@ public:
|
||||||
inline void report(Level severity, const CharType* format, va_list ap)
|
inline void report(Level severity, const CharType* format, va_list ap)
|
||||||
{
|
{
|
||||||
for (auto& logger : MainLoggers)
|
for (auto& logger : MainLoggers)
|
||||||
logger->report(m_modName, severity, format, ap);
|
{
|
||||||
|
va_list apc;
|
||||||
|
va_copy(apc, ap);
|
||||||
|
logger->report(m_modName, severity, format, apc);
|
||||||
|
va_end(apc);
|
||||||
|
}
|
||||||
if (severity == Error || severity == FatalError)
|
if (severity == Error || severity == FatalError)
|
||||||
LogVisorBp();
|
LogVisorBp();
|
||||||
if (severity == FatalError)
|
if (severity == FatalError)
|
||||||
|
@ -175,7 +180,13 @@ public:
|
||||||
inline void reportSource(Level severity, const char* file, unsigned linenum, const CharType* format, va_list ap)
|
inline void reportSource(Level severity, const char* file, unsigned linenum, const CharType* format, va_list ap)
|
||||||
{
|
{
|
||||||
for (auto& logger : MainLoggers)
|
for (auto& logger : MainLoggers)
|
||||||
logger->reportSource(m_modName, severity, file, linenum, format, ap);
|
{
|
||||||
|
va_list apc;
|
||||||
|
va_copy(apc, ap);
|
||||||
|
logger->reportSource(m_modName, severity, file, linenum, format, apc);
|
||||||
|
va_end(apc);
|
||||||
|
}
|
||||||
|
|
||||||
if (severity == FatalError)
|
if (severity == FatalError)
|
||||||
abort();
|
abort();
|
||||||
else if (severity == Error)
|
else if (severity == Error)
|
||||||
|
|
|
@ -332,6 +332,10 @@ struct FileLogger : public ILogger
|
||||||
thrName = ThreadMap[thrId];
|
thrName = ThreadMap[thrId];
|
||||||
|
|
||||||
fprintf(fp, "[");
|
fprintf(fp, "[");
|
||||||
|
fprintf(fp, "%5.4f ", tmd);
|
||||||
|
uint_fast64_t fIdx = FrameIndex.load();
|
||||||
|
if (fIdx)
|
||||||
|
fprintf(fp, "(%" PRIu64 ") ", fIdx);
|
||||||
switch (severity)
|
switch (severity)
|
||||||
{
|
{
|
||||||
case Info:
|
case Info:
|
||||||
|
@ -351,13 +355,9 @@ struct FileLogger : public ILogger
|
||||||
};
|
};
|
||||||
fprintf(fp, " %s", modName);
|
fprintf(fp, " %s", modName);
|
||||||
if (sourceInfo)
|
if (sourceInfo)
|
||||||
fprintf(stderr, " {%s}", sourceInfo);
|
fprintf(fp, " {%s}", sourceInfo);
|
||||||
if (thrName)
|
if (thrName)
|
||||||
fprintf(fp, " (%s)", thrName);
|
fprintf(fp, " (%s)", thrName);
|
||||||
fprintf(fp, " %5.4f", tmd);
|
|
||||||
uint_fast64_t fIdx = FrameIndex.load();
|
|
||||||
if (fIdx)
|
|
||||||
fprintf(fp, " (%" PRIu64 ")", fIdx);
|
|
||||||
fprintf(fp, "] ");
|
fprintf(fp, "] ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue