mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
* logger: print also thread id
This commit is contained in:
parent
38103aaac5
commit
1fae3baaa3
2 changed files with 16 additions and 4 deletions
4
Log.h
4
Log.h
|
@ -138,8 +138,9 @@ namespace log {
|
|||
std::time_t timestamp;
|
||||
std::string text; /**< message text as single string */
|
||||
LogLevel level; /**< message level */
|
||||
std::thread::id tid; /**< id of thread that generated message */
|
||||
|
||||
LogMsg (LogLevel lvl, std::time_t ts, const std::string & txt): timestamp(ts), text(txt), level(lvl) {};
|
||||
LogMsg (LogLevel lvl, std::time_t ts, const std::string & txt): timestamp(ts), text(txt), level(lvl), tid(0) {};
|
||||
};
|
||||
|
||||
Log & Logger();
|
||||
|
@ -178,6 +179,7 @@ void LogPrint (LogLevel level, TArgs... args)
|
|||
LogPrint (ss, args ...);
|
||||
|
||||
auto msg = std::make_shared<i2p::log::LogMsg>(level, std::time(nullptr), ss.str());
|
||||
msg->tid = std::this_thread::get_id();
|
||||
log.Append(msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue