logging_macros.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * DO NOT MODIFY - AUTO-GENERATED
3 *
4 *
5 * DISCLAMER:
6 *
7 * This project was created within an academic research setting, and thus should
8 * be considered as EXPERIMENTAL code. There may be bugs and deficiencies in the
9 * code, so please adjust expectations accordingly. With that said, we are
10 * intrinsically motivated to ensure its correctness (and often its performance).
11 * Please use the corresponding web repository tool (e.g. github/bitbucket/etc.)
12 * to file bugs, suggestions, pull requests; we will do our best to address them
13 * in a timely manner.
14 *
15 *
16 * SOFTWARE LICENSE AGREEMENT (BSD LICENSE):
17 *
18 * Copyright (c) 2013-2016, Anqi Xu and contributors
19 * All rights reserved.
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions
23 * are met:
24 *
25 * * Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * * Redistributions in binary form must reproduce the above
28 * copyright notice, this list of conditions and the following
29 * disclaimer in the documentation and/or other materials provided
30 * with the distribution.
31 * * Neither the name of the School of Computer Science, McGill University,
32 * nor the names of its contributors may be used to endorse or promote
33 * products derived from this software without specific prior written
34 * permission.
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
40 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
42 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 *******************************************************************************/
47 
48 #ifndef LOGGING_MACROS_HPP_
49 #define LOGGING_MACROS_HPP_
50 
56 #define STD_LOGGING_MACROS 0
57 #define ROS_LOGGING_MACROS 1
58 #define NODELET_LOGGING_MACROS 2
59 #define LOGGING_MACROS_TYPE NODELET_LOGGING_MACROS
60 
61 
62 #if LOGGING_MACROS_TYPE == ROS_LOGGING_MACROS
63 
64  #include <ros/console.h>
65 
66  #define DEBUG(...) ROS_DEBUG(__VA_ARGS__)
67  #define INFO(...) ROS_INFO(__VA_ARGS__)
68  #define WARN(...) ROS_WARN(__VA_ARGS__)
69  #define ERROR(...) ROS_ERROR(__VA_ARGS__)
70  #define FATAL(...) ROS_FATAL(__VA_ARGS__)
71  #define DEBUG_STREAM(...) ROS_DEBUG_STREAM(__VA_ARGS__)
72  #define INFO_STREAM(...) ROS_INFO_STREAM(__VA_ARGS__)
73  #define WARN_STREAM(...) ROS_WARN_STREAM(__VA_ARGS__)
74  #define ERROR_STREAM(...) ROS_ERROR_STREAM(__VA_ARGS__)
75  #define FATAL_STREAM(...) ROS_FATAL_STREAM(__VA_ARGS__)
76 
77 #elif LOGGING_MACROS_TYPE == NODELET_LOGGING_MACROS
78 
79  #include <ros/ros.h>
80  #include <nodelet/nodelet.h>
81 
82  using namespace ros::this_node;
83 
84  #define DEBUG(...) NODELET_DEBUG(__VA_ARGS__)
85  #define INFO(...) NODELET_INFO(__VA_ARGS__)
86  #define WARN(...) NODELET_WARN(__VA_ARGS__)
87  #define ERROR(...) NODELET_ERROR(__VA_ARGS__)
88  #define FATAL(...) NODELET_FATAL(__VA_ARGS__)
89  #define DEBUG_STREAM(...) NODELET_DEBUG_STREAM(__VA_ARGS__)
90  #define INFO_STREAM(...) NODELET_INFO_STREAM(__VA_ARGS__)
91  #define WARN_STREAM(...) NODELET_WARN_STREAM(__VA_ARGS__)
92  #define ERROR_STREAM(...) NODELET_ERROR_STREAM(__VA_ARGS__)
93  #define FATAL_STREAM(...) NODELET_FATAL_STREAM(__VA_ARGS__)
94 
95 #else
96  #include <cstdio>
97  #include <iostream>
98 
99  #define DEBUG(...) fprintf(stdout, "DEBUG> "); fprintf(stdout, __VA_ARGS__); fprintf(stdout, "\n")
100  #define INFO(...) fprintf(stdout, "INFO > "); fprintf(stdout, __VA_ARGS__); fprintf(stdout, "\n")
101  #define WARN(...) fprintf(stderr, "WARN > "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n")
102  #define ERROR(...) fprintf(stderr, "ERROR> "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n")
103  #define FATAL(...) fprintf(stderr, "FATAL> "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n")
104  #define DEBUG_STREAM(...) std::cout << "DEBUG> " << __VA_ARGS__ << std::endl
105  #define INFO_STREAM(...) std::cout << "INFO > " << __VA_ARGS__ << std::endl
106  #define WARN_STREAM(...) std::cerr << "WARN > " << __VA_ARGS__ << std::endl
107  #define ERROR_STREAM(...) std::cerr << "ERROR> " << __VA_ARGS__ << std::endl
108  #define FATAL_STREAM(...) std::cerr << "FATAL> " << __VA_ARGS__ << std::endl
109 
110 #endif
111 
112 #endif /* LOGGING_MACROS_HPP_ */


ueye_cam
Author(s): Anqi Xu
autogenerated on Fri Jan 22 2021 03:34:12