mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-24 06:32:06 +08:00
Added compile time option to turn off thread id (#define SPDLOG_NO_THREAD_ID in common.h)
This commit is contained in:
parent
0684b4f378
commit
25afbd79b2
@ -44,6 +44,10 @@
|
|||||||
//#define SPDLOG_CLOCK_COARSE
|
//#define SPDLOG_CLOCK_COARSE
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
|
// uncomment if thread id logging is needed - to gain few nanos
|
||||||
|
// #define SPDLOG_NO_THREAD_ID
|
||||||
|
//
|
||||||
namespace spdlog
|
namespace spdlog
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -65,8 +65,6 @@ public:
|
|||||||
_log_msg.logger_name = _callback_logger->name();
|
_log_msg.logger_name = _callback_logger->name();
|
||||||
_log_msg.time = os::now();
|
_log_msg.time = os::now();
|
||||||
_log_msg.thread_id = os::thread_id();
|
_log_msg.thread_id = os::thread_id();
|
||||||
|
|
||||||
|
|
||||||
_callback_logger->_log_msg(_log_msg);
|
_callback_logger->_log_msg(_log_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,10 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
|
|||||||
inline size_t thread_id()
|
inline size_t thread_id()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef SPDLOG_NO_THREAD_ID
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return ::GetCurrentThreadId();
|
return ::GetCurrentThreadId();
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
@ -182,7 +186,7 @@ inline size_t thread_id()
|
|||||||
#else
|
#else
|
||||||
return (uint64_t) pthread_self();
|
return (uint64_t) pthread_self();
|
||||||
#endif
|
#endif
|
||||||
|
#endif //SPDLOG_NO_THREAD_ID
|
||||||
}
|
}
|
||||||
|
|
||||||
} //os
|
} //os
|
||||||
|
Loading…
Reference in New Issue
Block a user