Skip to content

Commit

Permalink
Merge pull request #24 from scpeters/macro_namespace
Browse files Browse the repository at this point in the history
Add duplicate macros with namespace prefix
  • Loading branch information
scpeters committed Jan 15, 2016
2 parents f375f48 + 1b687b7 commit bbcc914
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8)
project(console_bridge)

set (CONSOLE_BRIDGE_MAJOR_VERSION 0)
set (CONSOLE_BRIDGE_MINOR_VERSION 2)
set (CONSOLE_BRIDGE_PATCH_VERSION 8)
set (CONSOLE_BRIDGE_MINOR_VERSION 3)
set (CONSOLE_BRIDGE_PATCH_VERSION 0)

set (CONSOLE_BRIDGE_VERSION ${CONSOLE_BRIDGE_MAJOR_VERSION}.${CONSOLE_BRIDGE_MINOR_VERSION}.${CONSOLE_BRIDGE_PATCH_VERSION})
message (STATUS "${PROJECT_NAME} version ${CONSOLE_BRIDGE_VERSION}")
Expand Down
39 changes: 35 additions & 4 deletions include/console_bridge/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@

#include "exportdecl.h"

#ifdef __GNUC__
#define CONSOLE_BRIDGE_DEPRECATED __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define CONSOLE_BRIDGE_DEPRECATED __declspec(deprecated)
#else
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
#define CONSOLE_BRIDGE_DEPRECATED
#endif

static inline void CONSOLE_BRIDGE_DEPRECATED console_bridge_deprecated() {}

/** \file console.h
\defgroup logging Logging Macros
\{
Expand All @@ -63,13 +74,33 @@
\}
*/
#define logError(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__)
#define CONSOLE_BRIDGE_logError(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__)

#define CONSOLE_BRIDGE_logWarn(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__)

#define CONSOLE_BRIDGE_logInform(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__)

#define CONSOLE_BRIDGE_logDebug(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__)

#define logError(fmt, ...) \
console_bridge_deprecated(); \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__)

#define logWarn(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__)
#define logWarn(fmt, ...) \
console_bridge_deprecated(); \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__)

#define logInform(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__)
#define logInform(fmt, ...) \
console_bridge_deprecated(); \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__)

#define logDebug(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__)
#define logDebug(fmt, ...) \
console_bridge_deprecated(); \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__)


/** \brief Message namespace. This contains classes needed to
Expand Down

0 comments on commit bbcc914

Please sign in to comment.