Skip to content

Commit 0c3d880

Browse files
committed
fool proof logging macros
1 parent 2e9365e commit 0c3d880

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/nbl/logging_macros.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#ifdef _GIT_INFO_H_INCLUDED_
2-
// when "git_info.h" is included
3-
# define NBL_LOG(SEVERITY, FORMAT, ...) NBL_LOG_FUNCTION(FORMAT" [%s][%s - %s:%d]", SEVERITY, __VA_ARGS__, nbl::gtml::nabla_git_info.commitShortHash, __FUNCTION__, __FILE__, __LINE__);
4-
# define NBL_LOG_ERROR(FORMAT, ...) NBL_LOG(nbl::system::ILogger::ELL_ERROR, FORMAT, __VA_ARGS__)
1+
#if defined(NBL_LOG) || defined(NBL_LOG_ERROR)
2+
#error redefinition of NBL_LOG/NBL_LOG_ERROR. did you forgot to undefine logging macros somewhere? #include "nbl/undefine_logging_macros.h"
3+
#elif !defined(_GIT_INFO_H_INCLUDED_)
4+
#error logging macros require git meta info, include "git_info.h"
55
#else
6-
# define NBL_LOG(SEVERITY, FORMAT, ...) NBL_LOG_FUNCTION(FORMAT" [%s - %s:%d]", SEVERITY, __VA_ARGS__, __FUNCTION__, __FILE__, __LINE__);
7-
# define NBL_LOG_ERROR(FORMAT, ...) NBL_LOG(nbl::system::ILogger::ELL_ERROR, FORMAT, __VA_ARGS__)
6+
#define NBL_LOG(SEVERITY, FORMAT, ...) NBL_LOG_FUNCTION(FORMAT" [%s][%s - %s:%d]", SEVERITY, __VA_ARGS__, nbl::gtml::nabla_git_info.commitShortHash, __FUNCTION__, __FILE__, __LINE__);
7+
#define NBL_LOG_ERROR(FORMAT, ...) NBL_LOG(nbl::system::ILogger::ELL_ERROR, FORMAT, __VA_ARGS__)
88
#endif

0 commit comments

Comments
 (0)