Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef LOGGING_MACROS_HPP_
00049 #define LOGGING_MACROS_HPP_
00050
00056 #define STD_LOGGING_MACROS 0
00057 #define ROS_LOGGING_MACROS 1
00058 #define NODELET_LOGGING_MACROS 2
00059 #define LOGGING_MACROS_TYPE NODELET_LOGGING_MACROS
00060
00061
00062 #if LOGGING_MACROS_TYPE == ROS_LOGGING_MACROS
00063
00064 #include <ros/console.h>
00065
00066 #define DEBUG(...) ROS_DEBUG(__VA_ARGS__)
00067 #define INFO(...) ROS_INFO(__VA_ARGS__)
00068 #define WARN(...) ROS_WARN(__VA_ARGS__)
00069 #define ERROR(...) ROS_ERROR(__VA_ARGS__)
00070 #define FATAL(...) ROS_FATAL(__VA_ARGS__)
00071 #define DEBUG_STREAM(...) ROS_DEBUG_STREAM(__VA_ARGS__)
00072 #define INFO_STREAM(...) ROS_INFO_STREAM(__VA_ARGS__)
00073 #define WARN_STREAM(...) ROS_WARN_STREAM(__VA_ARGS__)
00074 #define ERROR_STREAM(...) ROS_ERROR_STREAM(__VA_ARGS__)
00075 #define FATAL_STREAM(...) ROS_FATAL_STREAM(__VA_ARGS__)
00076
00077 #elif LOGGING_MACROS_TYPE == NODELET_LOGGING_MACROS
00078
00079 #include <ros/ros.h>
00080 #include <nodelet/nodelet.h>
00081
00082 using namespace ros::this_node;
00083
00084 #define DEBUG(...) NODELET_DEBUG(__VA_ARGS__)
00085 #define INFO(...) NODELET_INFO(__VA_ARGS__)
00086 #define WARN(...) NODELET_WARN(__VA_ARGS__)
00087 #define ERROR(...) NODELET_ERROR(__VA_ARGS__)
00088 #define FATAL(...) NODELET_FATAL(__VA_ARGS__)
00089 #define DEBUG_STREAM(...) NODELET_DEBUG_STREAM(__VA_ARGS__)
00090 #define INFO_STREAM(...) NODELET_INFO_STREAM(__VA_ARGS__)
00091 #define WARN_STREAM(...) NODELET_WARN_STREAM(__VA_ARGS__)
00092 #define ERROR_STREAM(...) NODELET_ERROR_STREAM(__VA_ARGS__)
00093 #define FATAL_STREAM(...) NODELET_FATAL_STREAM(__VA_ARGS__)
00094
00095 #else
00096 #include <cstdio>
00097 #include <iostream>
00098
00099 #define DEBUG(...) fprintf(stdout, "DEBUG> "); fprintf(stdout, __VA_ARGS__); fprintf(stdout, "\n")
00100 #define INFO(...) fprintf(stdout, "INFO > "); fprintf(stdout, __VA_ARGS__); fprintf(stdout, "\n")
00101 #define WARN(...) fprintf(stderr, "WARN > "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n")
00102 #define ERROR(...) fprintf(stderr, "ERROR> "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n")
00103 #define FATAL(...) fprintf(stderr, "FATAL> "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n")
00104 #define DEBUG_STREAM(...) std::cout << "DEBUG> " << __VA_ARGS__ << std::endl
00105 #define INFO_STREAM(...) std::cout << "INFO > " << __VA_ARGS__ << std::endl
00106 #define WARN_STREAM(...) std::cerr << "WARN > " << __VA_ARGS__ << std::endl
00107 #define ERROR_STREAM(...) std::cerr << "ERROR> " << __VA_ARGS__ << std::endl
00108 #define FATAL_STREAM(...) std::cerr << "FATAL> " << __VA_ARGS__ << std::endl
00109
00110 #endif
00111
00112 #endif