console_bridge_dev
master
It is a ROS-independent, pure CMake (i.e. non-catkin and non-rosbuild package) that provides logging calls that mirror those found in rosconsole, but for applications that are not necessarily using ROS.
|
Go to the documentation of this file.
37 #ifndef INCLUDE_CONSOLE_BRIDGE_CONSOLE_H_
38 #define INCLUDE_CONSOLE_BRIDGE_CONSOLE_H_
42 #include "./console_bridge_export.h"
66 #define CONSOLE_BRIDGE_logError(...) \
67 console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)
69 #define CONSOLE_BRIDGE_logWarn(...) \
70 console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)
72 #define CONSOLE_BRIDGE_logInform(...) \
73 console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)
75 #define CONSOLE_BRIDGE_logDebug(...) \
76 console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)
85 enum CONSOLE_BRIDGE_DLLAPI LogLevel
91 CONSOLE_BRIDGE_LOG_NONE
115 virtual void log(
const std::string &text, LogLevel level,
const char *filename,
int line) = 0;
126 virtual void log(
const std::string &text, LogLevel level,
const char *filename,
int line);
138 virtual void log(
const std::string &text, LogLevel level,
const char *filename,
int line);
172 CONSOLE_BRIDGE_DLLAPI
void setLogLevel(LogLevel level);
185 CONSOLE_BRIDGE_DLLAPI
void log(
const char *file,
192 #endif // INCLUDE_CONSOLE_BRIDGE_CONSOLE_H_
CONSOLE_BRIDGE_DLLAPI LogLevel getLogLevel(void)
Retrieve the current level of logging data. Messages with lower logging levels will not be recorded.
CONSOLE_BRIDGE_DLLAPI void restorePreviousOutputHandler(void)
Restore the output handler that was previously in use (if any)
CONSOLE_BRIDGE_DLLAPI void noOutputHandler(void)
This function instructs console bridge that no messages should be outputted. Equivalent to useOutputH...
Message namespace. This contains classes needed to output error messages (or logging) from within the...
Definition: console.h:82
CONSOLE_BRIDGE_LOG_ERROR
Definition: console.h:90
OutputHandlerSTD(void)
Definition: console.h:124
OutputHandler(void)
Definition: console.h:103
CONSOLE_BRIDGE_LOG_DEBUG
Definition: console.h:87
Default implementation of OutputHandler. This sends the information to the console.
Definition: console.h:121
CONSOLE_BRIDGE_DLLAPI void useOutputHandler(OutputHandler *oh)
Specify the instance of the OutputHandler to use. By default, this is OutputHandlerSTD.
CONSOLE_BRIDGE_DLLAPI void setLogLevel(LogLevel level)
Set the minimum level of logging data to output. Messages with lower logging levels will not be recor...
Implementation of OutputHandler that saves messages in a file.
Definition: console.h:130
virtual ~OutputHandler(void)
Definition: console.h:105
Generic class to handle output from a piece of code.
Definition: console.h:100
CONSOLE_BRIDGE_LOG_INFO
Definition: console.h:88
CONSOLE_BRIDGE_LOG_WARN
Definition: console.h:89
CONSOLE_BRIDGE_DLLAPI OutputHandler * getOutputHandler(void)
Get the instance of the OutputHandler currently used. This is NULL in case there is no output handler...
CONSOLE_BRIDGE_DLLAPI void log(const char *file, int line, LogLevel level, const char *m,...)
Root level logging function. This should not be invoked directly, but rather used via a logging macro...