mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 01:51:38 +08:00
Merge pull request #604 from sam-lunt/improve-macros
Ensure marcos always expand to expressions
This commit is contained in:
commit
32177aa77a
@ -170,24 +170,23 @@ void drop_all();
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SPDLOG_TRACE_ON
|
||||
#define SPDLOG_STR_H(x) #x
|
||||
#define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x)
|
||||
#ifdef _MSC_VER
|
||||
#define SPDLOG_TRACE(logger, ...) logger->trace("[ " __FILE__ "(" SPDLOG_STR_HELPER(__LINE__) ") ] " __VA_ARGS__)
|
||||
# define SPDLOG_STR_H(x) #x
|
||||
# define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x)
|
||||
# ifdef _MSC_VER
|
||||
# define SPDLOG_TRACE(logger, ...) logger->trace("[ " __FILE__ "(" SPDLOG_STR_HELPER(__LINE__) ") ] " __VA_ARGS__)
|
||||
# else
|
||||
# define SPDLOG_TRACE(logger, ...) logger->trace("[ " __FILE__ ":" SPDLOG_STR_HELPER(__LINE__) " ] " __VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
#define SPDLOG_TRACE(logger, ...) logger->trace("[ " __FILE__ ":" SPDLOG_STR_HELPER(__LINE__) " ] " __VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
#define SPDLOG_TRACE(logger, ...)
|
||||
# define SPDLOG_TRACE(logger, ...) (void)0
|
||||
#endif
|
||||
|
||||
#ifdef SPDLOG_DEBUG_ON
|
||||
#define SPDLOG_DEBUG(logger, ...) logger->debug(__VA_ARGS__)
|
||||
# define SPDLOG_DEBUG(logger, ...) logger->debug(__VA_ARGS__)
|
||||
#else
|
||||
#define SPDLOG_DEBUG(logger, ...)
|
||||
# define SPDLOG_DEBUG(logger, ...) (void)0
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include "details/spdlog_impl.h"
|
||||
|
Loading…
Reference in New Issue
Block a user