32 #ifndef ACADO_TOOLKIT_ACADO_MESSAGE_HANDLING_HPP 33 #define ACADO_TOOLKIT_ACADO_MESSAGE_HANDLING_HPP 60 #define COL_DEBUG "\033[1;34m" 61 #define COL_FATAL "\033[0;31m" 62 #define COL_ERROR "\033[1;31m" 63 #define COL_WARNING "\033[1;33m" 64 #define COL_INFO "\033[0m" 71 #define COL_WARNING "" 90 #define __FUNCTION__ 0 103 #define QUOTE(x) QUOTE_(x) 106 #define ACADOERROR(retval) \ 107 returnValue("Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_ERROR, retval) 110 #define ACADOERRORTEXT(retval, text) \ 111 returnValue("Message: "#text"\n Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_ERROR, retval) 114 #define ACADOFATAL(retval) \ 115 returnValue("Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_FATAL, retval) 118 #define ACADOFATALTEXT(retval, text) \ 119 returnValue("Message: "#text"\n Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_FATAL, retval) 122 #define ACADOWARNING(retval) \ 123 returnValue("Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_WARNING, retval) 126 #define ACADOWARNINGTEXT(retval,text) \ 127 returnValue("Message: "#text"\n Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_WARNING, retval) 130 #define ACADOINFO(retval) \ 131 returnValue("", LVL_INFO, retval) 134 #define ACADOINFOTEXT(retval,text) \ 135 returnValue("Message: "#text"\n Code: ("#retval") \n File: " __FILE__ "\n Line: " QUOTE(__LINE__), LVL_INFO, retval) 144 #define ACADO_TRY(X) for(returnValue ACADO_R = X; !ACADO_R;) return ACADO_R 193 #define LOG( level ) \ 194 if (level < Logger::instance().getLogLevel()); \ 195 else Logger::instance().get( level ) 201 class MatlabConsoleStreamBuf :
public std::basic_streambuf<char>
204 int_type overflow( int_type ch = traits_type::eof() )
206 if (!traits_type::eq_int_type(ch, traits_type::eof()))
207 return mexPrintf(
"%c", traits_type::to_char_type(ch)) > 0 ? 0 : traits_type::eof();
217 RedirectStream(std::ostream& stream, std::streambuf& new_streambuf)
219 , _old_streambuf(stream.rdbuf())
221 _stream.rdbuf(&new_streambuf);
226 _stream.rdbuf(_old_streambuf);
230 std::ostream& _stream;
231 std::streambuf * _old_streambuf;
239 #endif // ACADO_TOOLKIT_ACADO_MESSAGE_HANDLING_HPP A very simple logging class.
returnValue was not yet handled by user
#define CLOSE_NAMESPACE_ACADO
const char * returnValueTypeToString(returnValueType type)
returnValueType
Defines all symbols for global return values.
returnValueLevel logLevel
static Logger & instance()
Returned value is a fatal error, assert like use, aborts execution is unhandled.
returnValueLevel getLogLevel()
#define BEGIN_NAMESPACE_ACADO
returnValue was handled by user
Logger & setLogLevel(returnValueLevel level)
Logger & operator=(const Logger &)
const char * returnValueLevelToString(returnValueLevel level)