Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor log function.

Slight reorganization to allow for variable reuse and elimination.
  • Loading branch information...
commit d224a8b0af60169ff124fdc4a487062543c53187 1 parent 215814a
althekiller authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 xbmc/utils/log.cpp
View
10 xbmc/utils/log.cpp
@@ -79,8 +79,6 @@ void CLog::Log(int loglevel, const char *format, ... )
CStdString strPrefix, strData;
- strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), (uint64_t)stat.dwAvailPhys, levelNames[loglevel]);
-
strData.reserve(16384);
va_list va;
va_start(va, format);
@@ -94,12 +92,12 @@ void CLog::Log(int loglevel, const char *format, ... )
}
else if (m_repeatCount)
{
- CStdString strPrefix2, strData2;
- strPrefix2.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), (uint64_t)stat.dwAvailPhys, levelNames[m_repeatLogLevel]);
+ CStdString strData2;
+ strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), (uint64_t)stat.dwAvailPhys, levelNames[m_repeatLogLevel]);
strData2.Format("Previous line repeats %d times." LINE_ENDING, m_repeatCount);
OutputDebugString(strData2);
- fputs(strPrefix2.c_str(), m_file);
+ fputs(strPrefix.c_str(), m_file);
fputs(strData2.c_str(), m_file);
m_repeatCount = 0;
}
@@ -125,6 +123,8 @@ void CLog::Log(int loglevel, const char *format, ... )
strData.Replace("\n", LINE_ENDING" ");
strData += LINE_ENDING;
+ strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), (uint64_t)stat.dwAvailPhys, levelNames[loglevel]);
+
fputs(strPrefix.c_str(), m_file);
fputs(strData.c_str(), m_file);
fflush(m_file);
Please sign in to comment.
Something went wrong with that request. Please try again.