Logger: added %O to message format to display numeric thread id in logs.

This commit is contained in:
Matej Kenda
2015-06-01 10:00:56 +02:00
parent f1e6cba313
commit e26bb65a5b
4 changed files with 18 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ namespace Poco {
Message::Message():
_prio(PRIO_FATAL),
_tid(0),
_ostid(0),
_pid(0),
_file(0),
_line(0),
@@ -43,6 +44,7 @@ Message::Message(const std::string& source, const std::string& text, Priority pr
_text(text),
_prio(prio),
_tid(0),
_ostid(0),
_pid(0),
_file(0),
_line(0),
@@ -57,6 +59,7 @@ Message::Message(const std::string& source, const std::string& text, Priority pr
_text(text),
_prio(prio),
_tid(0),
_ostid(0),
_pid(0),
_file(file),
_line(line),
@@ -72,6 +75,7 @@ Message::Message(const Message& msg):
_prio(msg._prio),
_time(msg._time),
_tid(msg._tid),
_ostid(msg._ostid),
_thread(msg._thread),
_pid(msg._pid),
_file(msg._file),
@@ -90,6 +94,7 @@ Message::Message(const Message& msg, const std::string& text):
_prio(msg._prio),
_time(msg._time),
_tid(msg._tid),
_ostid(msg._ostid),
_thread(msg._thread),
_pid(msg._pid),
_file(msg._file),
@@ -113,6 +118,7 @@ void Message::init()
#if !defined(POCO_VXWORKS)
_pid = Process::id();
#endif
_ostid = Thread::currentTid();
Thread* pThread = Thread::current();
if (pThread)
{

View File

@@ -75,6 +75,7 @@ void PatternFormatter::format(const Message& msg, std::string& text)
case 'P': NumberFormatter::append(text, msg.getPid()); break;
case 'T': text.append(msg.getThread()); break;
case 'I': NumberFormatter::append(text, msg.getTid()); break;
case 'O': NumberFormatter::append(text, msg.getOsTid()); break;
case 'N': text.append(Environment::nodeName()); break;
case 'U': text.append(msg.getSourceFile() ? msg.getSourceFile() : ""); break;
case 'u': NumberFormatter::append(text, msg.getSourceLine()); break;