Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.6)
project(console_bridge)

set (CONSOLE_BRIDGE_MAJOR_VERSION 0)
set (CONSOLE_BRIDGE_MINOR_VERSION 3)
set (CONSOLE_BRIDGE_MINOR_VERSION 4)
set (CONSOLE_BRIDGE_PATCH_VERSION 0)

set (CONSOLE_BRIDGE_VERSION ${CONSOLE_BRIDGE_MAJOR_VERSION}.${CONSOLE_BRIDGE_MINOR_VERSION}.${CONSOLE_BRIDGE_PATCH_VERSION})
Expand Down
27 changes: 4 additions & 23 deletions include/console_bridge/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,23 @@

#include "console_bridge_export.h"

static inline void CONSOLE_BRIDGE_DEPRECATED console_bridge_deprecated() {}

/** \file console.h
\defgroup logging Logging Macros
\{

\def logError(fmt, ...)
\def CONSOLE_BRIDGE_logError(fmt, ...)
\brief Log a formatted error string.
\remarks This macro takes the same arguments as <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf">printf</a>.

\def logWarn(fmt, ...)
\def CONSOLE_BRIDGE_logWarn(fmt, ...)
\brief Log a formatted warning string.
\remarks This macro takes the same arguments as <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf">printf</a>.

\def logInform(fmt, ...)
\def CONSOLE_BRIDGE_logInform(fmt, ...)
\brief Log a formatted information string.
\remarks This macro takes the same arguments as <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf">printf</a>.

\def logDebug(fmt, ...)
\def CONSOLE_BRIDGE_logDebug(fmt, ...)
\brief Log a formatted debugging string.
\remarks This macro takes the same arguments as <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf">printf</a>.

Expand All @@ -77,18 +75,6 @@ static inline void CONSOLE_BRIDGE_DEPRECATED console_bridge_deprecated() {}
#define CONSOLE_BRIDGE_logDebug(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__)

#define logError(fmt, ...) \
console_bridge::log_deprecated(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__)

#define logWarn(fmt, ...) \
console_bridge::log_deprecated(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__)

#define logInform(fmt, ...) \
console_bridge::log_deprecated(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__)

#define logDebug(fmt, ...) \
console_bridge::log_deprecated(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__)


/** \brief Message namespace. This contains classes needed to
output error messages (or logging) from within the library.
Expand Down Expand Up @@ -186,11 +172,6 @@ CONSOLE_BRIDGE_DLLAPI LogLevel getLogLevel(void);
but rather used via a \ref logging "logging macro". Formats the message
string given the arguments and forwards the string to the output handler */
CONSOLE_BRIDGE_DLLAPI void log(const char *file, int line, LogLevel level, const char* m, ...);

/** \brief Root level logging function. This should not be invoked directly,
but rather used via a \ref logging "logging macro". Formats the message
string given the arguments and forwards the string to the output handler */
CONSOLE_BRIDGE_DEPRECATED CONSOLE_BRIDGE_DLLAPI void log_deprecated(const char *file, int line, LogLevel level, const char* m, ...);
}


Expand Down
26 changes: 0 additions & 26 deletions src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,32 +103,6 @@ console_bridge::OutputHandler* console_bridge::getOutputHandler(void)
return getDOH()->output_handler_;
}

void console_bridge::log_deprecated(const char *file, int line,
LogLevel level, const char* m, ...)
{
/*
* Workaround: see bug ros/console 30
* Exact copy of console_bridge::log, please remove it once the
* deprecation time expires.
*/
USE_DOH;
if (doh->output_handler_ && level >= doh->logLevel_)
{
va_list __ap;
va_start(__ap, m);
char buf[MAX_BUFFER_SIZE];
#ifdef _MSC_VER
vsnprintf_s(buf, sizeof(buf), _TRUNCATE, m, __ap);
#else
vsnprintf(buf, sizeof(buf), m, __ap);
#endif
va_end(__ap);
buf[MAX_BUFFER_SIZE - 1] = '\0';

doh->output_handler_->log(buf, level, file, line);
}
}

void console_bridge::log(const char *file, int line, LogLevel level, const char* m, ...)
{
USE_DOH;
Expand Down
8 changes: 0 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ include_directories(${GTEST_INCLUDE_DIRS})
set(tests
console_TEST.cc)

if (MSVC)
set_source_files_properties(console_TEST.cc PROPERTIES COMPILE_FLAGS
/wd4996)
else()
set_source_files_properties(console_TEST.cc PROPERTIES COMPILE_FLAGS
-Wno-deprecated-declarations)
endif()

#################################################
# Build all the tests
foreach(GTEST_SOURCE_file ${tests})
Expand Down
8 changes: 4 additions & 4 deletions test/console_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
TEST(ConsoleTest, MacroExpansionTest_ItShouldCompile)
{
if (true)
logDebug("Testing Log");
CONSOLE_BRIDGE_logDebug("Testing Log");

if (true)
logDebug("Testing Log");
CONSOLE_BRIDGE_logDebug("Testing Log");
else
{
assert(true);
}

if (true)
{
logDebug("Testing Log");
CONSOLE_BRIDGE_logDebug("Testing Log");
}
else
{
logDebug("Testing Log");
CONSOLE_BRIDGE_logDebug("Testing Log");
}
}