mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
Merge pull request #515 from elelel/trace
Compiler-dependent line numbering
This commit is contained in:
commit
e303f02cce
@ -168,8 +168,13 @@ void drop_all();
|
|||||||
#ifdef SPDLOG_TRACE_ON
|
#ifdef SPDLOG_TRACE_ON
|
||||||
#define SPDLOG_STR_H(x) #x
|
#define SPDLOG_STR_H(x) #x
|
||||||
#define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x)
|
#define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x)
|
||||||
#define SPDLOG_TRACE(logger, ...) logger->trace("[" __FILE__ " line #" SPDLOG_STR_HELPER(__LINE__) "] " __VA_ARGS__)
|
#ifdef _MSC_VER
|
||||||
#define SPDLOG_TRACE_IF(logger, flag, ...) logger->trace_if(flag, "[" __FILE__ " line #" SPDLOG_STR_HELPER(__LINE__) "] " __VA_ARGS__)
|
#define SPDLOG_TRACE(logger, ...) logger->trace("[ " __FILE__ "(" SPDLOG_STR_HELPER(__LINE__) ") ] " __VA_ARGS__)
|
||||||
|
#define SPDLOG_TRACE_IF(logger, flag, ...) logger.trace_if(flag, "[ " __FILE__ "(" SPDLOG_STR_HELPER(__LINE__) ") ] " __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define SPDLOG_TRACE(logger, ...) logger->trace("[ " __FILE__ ":" SPDLOG_STR_HELPER(__LINE__) " ] " __VA_ARGS__)
|
||||||
|
#define SPDLOG_TRACE_IF(logger, flag, ...) logger.trace_if(flag, "[ " __FILE__ ":" SPDLOG_STR_HELPER(__LINE__) " ] " __VA_ARGS__)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_TRACE(logger, ...)
|
#define SPDLOG_TRACE(logger, ...)
|
||||||
#define SPDLOG_TRACE_IF(logger, flag, ...)
|
#define SPDLOG_TRACE_IF(logger, flag, ...)
|
||||||
|
Loading…
Reference in New Issue
Block a user