mrpt_log_macros.h
Go to the documentation of this file.
00001 #ifndef MRPT_BRIDGE_LOG_MACROS_H
00002 #define MRPT_BRIDGE_LOG_MACROS_H
00003 
00004 #include <cstdarg>
00005 
00006 #define MRPT_VIRTUAL_LOG_MACROS                     \
00007    protected:                                       \
00008         virtual void log_debug(const char* format, ...) \
00009         {                                               \
00010                 va_list argptr;                             \
00011                 va_start(argptr, format);                   \
00012                 fprintf(stdout, "DEBUG: ");                 \
00013                 vfprintf(stdout, format, argptr);           \
00014                 fprintf(stdout, "\n");                      \
00015                 va_end(argptr);                             \
00016         }                                               \
00017                                                     \
00018    protected:                                       \
00019         virtual void log_info(const char* format, ...)  \
00020         {                                               \
00021                 va_list argptr;                             \
00022                 va_start(argptr, format);                   \
00023                 fprintf(stdout, "INFO: ");                  \
00024                 vfprintf(stdout, format, argptr);           \
00025                 fprintf(stdout, "\n");                      \
00026                 va_end(argptr);                             \
00027         }                                               \
00028                                                     \
00029    protected:                                       \
00030         virtual void log_warn(const char* format, ...)  \
00031         {                                               \
00032                 va_list argptr;                             \
00033                 va_start(argptr, format);                   \
00034                 fprintf(stderr, "WARNING: ");               \
00035                 vfprintf(stderr, format, argptr);           \
00036                 fprintf(stderr, "\n");                      \
00037                 va_end(argptr);                             \
00038         }                                               \
00039                                                     \
00040    protected:                                       \
00041         virtual void log_error(const char* format, ...) \
00042         {                                               \
00043                 va_list argptr;                             \
00044                 va_start(argptr, format);                   \
00045                 fprintf(stderr, "ERROR: ");                 \
00046                 vfprintf(stderr, format, argptr);           \
00047                 fprintf(stderr, "\n");                      \
00048                 va_end(argptr);                             \
00049         }
00050 
00051 #define MRPT_ROS_LOG_MACROS                         \
00052    protected:                                       \
00053         virtual void log_debug(const char* format, ...) \
00054         {                                               \
00055                 char buffer[0x1FF];                         \
00056                 va_list argptr;                             \
00057                 va_start(argptr, format);                   \
00058                 vsprintf(buffer, format, argptr);           \
00059                 ROS_DEBUG("%s", buffer);                    \
00060                 va_end(argptr);                             \
00061         }                                               \
00062                                                     \
00063    protected:                                       \
00064         virtual void log_info(const char* format, ...)  \
00065         {                                               \
00066                 char buffer[0x1FF];                         \
00067                 va_list argptr;                             \
00068                 va_start(argptr, format);                   \
00069                 vsprintf(buffer, format, argptr);           \
00070                 ROS_INFO("%s", buffer);                     \
00071                 va_end(argptr);                             \
00072         }                                               \
00073                                                     \
00074    protected:                                       \
00075         virtual void log_warn(const char* format, ...)  \
00076         {                                               \
00077                 char buffer[0x1FF];                         \
00078                 va_list argptr;                             \
00079                 va_start(argptr, format);                   \
00080                 vsprintf(buffer, format, argptr);           \
00081                 ROS_WARN("%s", buffer);                     \
00082                 va_end(argptr);                             \
00083         }                                               \
00084                                                     \
00085    protected:                                       \
00086         virtual void log_error(const char* format, ...) \
00087         {                                               \
00088                 char buffer[0x1FF];                         \
00089                 va_list argptr;                             \
00090                 va_start(argptr, format);                   \
00091                 vsprintf(buffer, format, argptr);           \
00092                 ROS_ERROR("%s", buffer);                    \
00093                 va_end(argptr);                             \
00094         }
00095 
00096 #endif  // MRPT_BRIDGE_LOG_MACROS_H


mrpt_bridge
Author(s): Markus Bader , Raphael Zack
autogenerated on Mon Sep 18 2017 03:12:06