logger: set thread id column width to 2 29/50429/3
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Wed, 28 Oct 2015 12:37:05 +0000 (13:37 +0100)
committerJan Olszak <j.olszak@samsung.com>
Wed, 28 Oct 2015 13:50:18 +0000 (06:50 -0700)
[Feature]       Thread ID is often 2 digit number, reflect that
[Cause]         N/A
[Solution]      N/A
[Verification]  Run some tests and verify visually

Change-Id: Iec1ddbb5bc3e28fc0c2ac199cbdf673348405537

libs/logger/formatter.cpp

index 06404f2..6733ade 100644 (file)
@@ -40,7 +40,8 @@ namespace {
 
 const int TIME_COLUMN_LENGTH = 12;
 const int SEVERITY_COLUMN_LENGTH = 8;
-const int PROCESS_COLUMN_LENGTH = 8;
+const int PID_COLUMN_LENGTH = 8;
+const int TID_COLUMN_LENGTH = 2;
 const int FILE_COLUMN_LENGTH = 60;
 
 std::atomic<unsigned int> gNextThreadId(1);
@@ -123,7 +124,8 @@ std::string LogFormatter::getHeader(LogLevel logLevel,
     std::ostringstream logLine;
     logLine << getCurrentTime() << ' '
             << std::left << std::setw(SEVERITY_COLUMN_LENGTH) << '[' + toString(logLevel) + ']'
-            << std::right << std::setw(PROCESS_COLUMN_LENGTH) << ::getpid() << "/" << getCurrentThread() << ": "
+            << std::right << std::setw(PID_COLUMN_LENGTH) << ::getpid() << "/"
+            << std::right << std::setw(TID_COLUMN_LENGTH) << getCurrentThread() << ": "
             << std::left << std::setw(FILE_COLUMN_LENGTH)
             << file + ':' + std::to_string(line) + ' ' + func + ':';
     return logLine.str();