Skip to content

Commit

Permalink
Define our prefix format just once.
Browse files Browse the repository at this point in the history
  • Loading branch information
althekiller committed Feb 10, 2011
1 parent d13f1a8 commit 215814a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xbmc/utils/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void CLog::Close()

void CLog::Log(int loglevel, const char *format, ... )
{
static const char* prefixFormat = "%02.2d:%02.2d:%02.2d T:%"PRIu64" M:%9"PRIu64" %7s: ";
CSingleLock waitLock(critSec);
#if !(defined(_DEBUG) || defined(PROFILE))
if (m_logLevel > LOG_LEVEL_NORMAL ||
Expand All @@ -78,7 +79,7 @@ void CLog::Log(int loglevel, const char *format, ... )

CStdString strPrefix, strData;

strPrefix.Format("%02.2d:%02.2d:%02.2d T:%"PRIu64" M:%9"PRIu64" %7s: ", time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), (uint64_t)stat.dwAvailPhys, levelNames[loglevel]);
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;
Expand All @@ -94,7 +95,7 @@ void CLog::Log(int loglevel, const char *format, ... )
else if (m_repeatCount)
{
CStdString strPrefix2, strData2;
strPrefix2.Format("%02.2d:%02.2d:%02.2d T:%"PRIu64" M:%9"PRIu64" %7s: ", time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), (uint64_t)stat.dwAvailPhys, levelNames[m_repeatLogLevel]);
strPrefix2.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);
Expand Down

0 comments on commit 215814a

Please sign in to comment.