rclcpp
master
C++ ROS Client Library API
include
rclcpp
logging.hpp
Go to the documentation of this file.
1
// generated from rclcpp/resource/logging.hpp.em
2
3
// Copyright 2017 Open Source Robotics Foundation, Inc.
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
17
#ifndef RCLCPP__LOGGING_HPP_
18
#define RCLCPP__LOGGING_HPP_
19
20
#include <type_traits>
21
22
#include "
rclcpp/logger.hpp
"
23
#include "
rcutils/logging_macros.h
"
24
#include "
rclcpp/utilities.hpp
"
25
26
// These are used for compiling out logging macros lower than a minimum severity.
27
#define RCLCPP_LOG_MIN_SEVERITY_DEBUG 0
28
#define RCLCPP_LOG_MIN_SEVERITY_INFO 1
29
#define RCLCPP_LOG_MIN_SEVERITY_WARN 2
30
#define RCLCPP_LOG_MIN_SEVERITY_ERROR 3
31
#define RCLCPP_LOG_MIN_SEVERITY_FATAL 4
32
#define RCLCPP_LOG_MIN_SEVERITY_NONE 5
33
34
#define RCLCPP_FIRST_ARG(N, ...) N
35
#define RCLCPP_ALL_BUT_FIRST_ARGS(N, ...) __VA_ARGS__
36
43
#ifndef RCLCPP_LOG_MIN_SEVERITY
44
#define RCLCPP_LOG_MIN_SEVERITY RCLCPP_LOG_MIN_SEVERITY_DEBUG
45
#endif
46
49
#if (RCLCPP_LOG_MIN_SEVERITY > RCLCPP_LOG_MIN_SEVERITY_DEBUG)
51
// empty logging macros for severity DEBUG when being disabled at compile time
53
#define RCLCPP_DEBUG(...)
54
#define RCLCPP_DEBUG_ONCE(...)
56
#define RCLCPP_DEBUG_EXPRESSION(...)
58
#define RCLCPP_DEBUG_FUNCTION(...)
60
#define RCLCPP_DEBUG_SKIPFIRST(...)
62
63
#else
64
// The RCLCPP_DEBUG macro is surrounded by do { .. } while (0)
65
// to implement the standard C macro idiom to make the macro safe in all
66
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
74
#define RCLCPP_DEBUG(logger, ...) \
75
do { \
76
static_assert( \
77
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
78
typename ::rclcpp::Logger>::value, \
79
"First argument to logging macros must be an rclcpp::Logger"); \
80
RCUTILS_LOG_DEBUG_NAMED( \
81
logger.get_name(), \
82
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
83
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
84
} while (0)
85
86
// The RCLCPP_DEBUG_ONCE macro is surrounded by do { .. } while (0)
87
// to implement the standard C macro idiom to make the macro safe in all
88
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
97
#define RCLCPP_DEBUG_ONCE(logger, ...) \
98
do { \
99
static_assert( \
100
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
101
typename ::rclcpp::Logger>::value, \
102
"First argument to logging macros must be an rclcpp::Logger"); \
103
RCUTILS_LOG_DEBUG_ONCE_NAMED( \
104
logger.get_name(), \
105
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
106
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
107
} while (0)
108
109
// The RCLCPP_DEBUG_EXPRESSION macro is surrounded by do { .. } while (0)
110
// to implement the standard C macro idiom to make the macro safe in all
111
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
121
#define RCLCPP_DEBUG_EXPRESSION(logger, expression, ...) \
122
do { \
123
static_assert( \
124
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
125
typename ::rclcpp::Logger>::value, \
126
"First argument to logging macros must be an rclcpp::Logger"); \
127
RCUTILS_LOG_DEBUG_EXPRESSION_NAMED( \
128
expression, \
129
logger.get_name(), \
130
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
131
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
132
} while (0)
133
134
// The RCLCPP_DEBUG_FUNCTION macro is surrounded by do { .. } while (0)
135
// to implement the standard C macro idiom to make the macro safe in all
136
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
146
#define RCLCPP_DEBUG_FUNCTION(logger, function, ...) \
147
do { \
148
static_assert( \
149
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
150
typename ::rclcpp::Logger>::value, \
151
"First argument to logging macros must be an rclcpp::Logger"); \
152
RCUTILS_LOG_DEBUG_FUNCTION_NAMED( \
153
function, \
154
logger.get_name(), \
155
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
156
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
157
} while (0)
158
159
// The RCLCPP_DEBUG_SKIPFIRST macro is surrounded by do { .. } while (0)
160
// to implement the standard C macro idiom to make the macro safe in all
161
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
170
#define RCLCPP_DEBUG_SKIPFIRST(logger, ...) \
171
do { \
172
static_assert( \
173
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
174
typename ::rclcpp::Logger>::value, \
175
"First argument to logging macros must be an rclcpp::Logger"); \
176
RCUTILS_LOG_DEBUG_SKIPFIRST_NAMED( \
177
logger.get_name(), \
178
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
179
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
180
} while (0)
181
182
#endif
183
187
#if (RCLCPP_LOG_MIN_SEVERITY > RCLCPP_LOG_MIN_SEVERITY_INFO)
189
// empty logging macros for severity INFO when being disabled at compile time
191
#define RCLCPP_INFO(...)
192
#define RCLCPP_INFO_ONCE(...)
194
#define RCLCPP_INFO_EXPRESSION(...)
196
#define RCLCPP_INFO_FUNCTION(...)
198
#define RCLCPP_INFO_SKIPFIRST(...)
200
201
#else
202
// The RCLCPP_INFO macro is surrounded by do { .. } while (0)
203
// to implement the standard C macro idiom to make the macro safe in all
204
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
212
#define RCLCPP_INFO(logger, ...) \
213
do { \
214
static_assert( \
215
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
216
typename ::rclcpp::Logger>::value, \
217
"First argument to logging macros must be an rclcpp::Logger"); \
218
RCUTILS_LOG_INFO_NAMED( \
219
logger.get_name(), \
220
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
221
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
222
} while (0)
223
224
// The RCLCPP_INFO_ONCE macro is surrounded by do { .. } while (0)
225
// to implement the standard C macro idiom to make the macro safe in all
226
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
235
#define RCLCPP_INFO_ONCE(logger, ...) \
236
do { \
237
static_assert( \
238
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
239
typename ::rclcpp::Logger>::value, \
240
"First argument to logging macros must be an rclcpp::Logger"); \
241
RCUTILS_LOG_INFO_ONCE_NAMED( \
242
logger.get_name(), \
243
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
244
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
245
} while (0)
246
247
// The RCLCPP_INFO_EXPRESSION macro is surrounded by do { .. } while (0)
248
// to implement the standard C macro idiom to make the macro safe in all
249
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
259
#define RCLCPP_INFO_EXPRESSION(logger, expression, ...) \
260
do { \
261
static_assert( \
262
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
263
typename ::rclcpp::Logger>::value, \
264
"First argument to logging macros must be an rclcpp::Logger"); \
265
RCUTILS_LOG_INFO_EXPRESSION_NAMED( \
266
expression, \
267
logger.get_name(), \
268
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
269
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
270
} while (0)
271
272
// The RCLCPP_INFO_FUNCTION macro is surrounded by do { .. } while (0)
273
// to implement the standard C macro idiom to make the macro safe in all
274
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
284
#define RCLCPP_INFO_FUNCTION(logger, function, ...) \
285
do { \
286
static_assert( \
287
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
288
typename ::rclcpp::Logger>::value, \
289
"First argument to logging macros must be an rclcpp::Logger"); \
290
RCUTILS_LOG_INFO_FUNCTION_NAMED( \
291
function, \
292
logger.get_name(), \
293
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
294
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
295
} while (0)
296
297
// The RCLCPP_INFO_SKIPFIRST macro is surrounded by do { .. } while (0)
298
// to implement the standard C macro idiom to make the macro safe in all
299
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
308
#define RCLCPP_INFO_SKIPFIRST(logger, ...) \
309
do { \
310
static_assert( \
311
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
312
typename ::rclcpp::Logger>::value, \
313
"First argument to logging macros must be an rclcpp::Logger"); \
314
RCUTILS_LOG_INFO_SKIPFIRST_NAMED( \
315
logger.get_name(), \
316
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
317
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
318
} while (0)
319
320
#endif
321
325
#if (RCLCPP_LOG_MIN_SEVERITY > RCLCPP_LOG_MIN_SEVERITY_WARN)
327
// empty logging macros for severity WARN when being disabled at compile time
329
#define RCLCPP_WARN(...)
330
#define RCLCPP_WARN_ONCE(...)
332
#define RCLCPP_WARN_EXPRESSION(...)
334
#define RCLCPP_WARN_FUNCTION(...)
336
#define RCLCPP_WARN_SKIPFIRST(...)
338
339
#else
340
// The RCLCPP_WARN macro is surrounded by do { .. } while (0)
341
// to implement the standard C macro idiom to make the macro safe in all
342
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
350
#define RCLCPP_WARN(logger, ...) \
351
do { \
352
static_assert( \
353
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
354
typename ::rclcpp::Logger>::value, \
355
"First argument to logging macros must be an rclcpp::Logger"); \
356
RCUTILS_LOG_WARN_NAMED( \
357
logger.get_name(), \
358
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
359
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
360
} while (0)
361
362
// The RCLCPP_WARN_ONCE macro is surrounded by do { .. } while (0)
363
// to implement the standard C macro idiom to make the macro safe in all
364
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
373
#define RCLCPP_WARN_ONCE(logger, ...) \
374
do { \
375
static_assert( \
376
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
377
typename ::rclcpp::Logger>::value, \
378
"First argument to logging macros must be an rclcpp::Logger"); \
379
RCUTILS_LOG_WARN_ONCE_NAMED( \
380
logger.get_name(), \
381
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
382
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
383
} while (0)
384
385
// The RCLCPP_WARN_EXPRESSION macro is surrounded by do { .. } while (0)
386
// to implement the standard C macro idiom to make the macro safe in all
387
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
397
#define RCLCPP_WARN_EXPRESSION(logger, expression, ...) \
398
do { \
399
static_assert( \
400
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
401
typename ::rclcpp::Logger>::value, \
402
"First argument to logging macros must be an rclcpp::Logger"); \
403
RCUTILS_LOG_WARN_EXPRESSION_NAMED( \
404
expression, \
405
logger.get_name(), \
406
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
407
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
408
} while (0)
409
410
// The RCLCPP_WARN_FUNCTION macro is surrounded by do { .. } while (0)
411
// to implement the standard C macro idiom to make the macro safe in all
412
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
422
#define RCLCPP_WARN_FUNCTION(logger, function, ...) \
423
do { \
424
static_assert( \
425
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
426
typename ::rclcpp::Logger>::value, \
427
"First argument to logging macros must be an rclcpp::Logger"); \
428
RCUTILS_LOG_WARN_FUNCTION_NAMED( \
429
function, \
430
logger.get_name(), \
431
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
432
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
433
} while (0)
434
435
// The RCLCPP_WARN_SKIPFIRST macro is surrounded by do { .. } while (0)
436
// to implement the standard C macro idiom to make the macro safe in all
437
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
446
#define RCLCPP_WARN_SKIPFIRST(logger, ...) \
447
do { \
448
static_assert( \
449
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
450
typename ::rclcpp::Logger>::value, \
451
"First argument to logging macros must be an rclcpp::Logger"); \
452
RCUTILS_LOG_WARN_SKIPFIRST_NAMED( \
453
logger.get_name(), \
454
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
455
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
456
} while (0)
457
458
#endif
459
463
#if (RCLCPP_LOG_MIN_SEVERITY > RCLCPP_LOG_MIN_SEVERITY_ERROR)
465
// empty logging macros for severity ERROR when being disabled at compile time
467
#define RCLCPP_ERROR(...)
468
#define RCLCPP_ERROR_ONCE(...)
470
#define RCLCPP_ERROR_EXPRESSION(...)
472
#define RCLCPP_ERROR_FUNCTION(...)
474
#define RCLCPP_ERROR_SKIPFIRST(...)
476
477
#else
478
// The RCLCPP_ERROR macro is surrounded by do { .. } while (0)
479
// to implement the standard C macro idiom to make the macro safe in all
480
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
488
#define RCLCPP_ERROR(logger, ...) \
489
do { \
490
static_assert( \
491
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
492
typename ::rclcpp::Logger>::value, \
493
"First argument to logging macros must be an rclcpp::Logger"); \
494
RCUTILS_LOG_ERROR_NAMED( \
495
logger.get_name(), \
496
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
497
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
498
} while (0)
499
500
// The RCLCPP_ERROR_ONCE macro is surrounded by do { .. } while (0)
501
// to implement the standard C macro idiom to make the macro safe in all
502
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
511
#define RCLCPP_ERROR_ONCE(logger, ...) \
512
do { \
513
static_assert( \
514
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
515
typename ::rclcpp::Logger>::value, \
516
"First argument to logging macros must be an rclcpp::Logger"); \
517
RCUTILS_LOG_ERROR_ONCE_NAMED( \
518
logger.get_name(), \
519
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
520
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
521
} while (0)
522
523
// The RCLCPP_ERROR_EXPRESSION macro is surrounded by do { .. } while (0)
524
// to implement the standard C macro idiom to make the macro safe in all
525
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
535
#define RCLCPP_ERROR_EXPRESSION(logger, expression, ...) \
536
do { \
537
static_assert( \
538
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
539
typename ::rclcpp::Logger>::value, \
540
"First argument to logging macros must be an rclcpp::Logger"); \
541
RCUTILS_LOG_ERROR_EXPRESSION_NAMED( \
542
expression, \
543
logger.get_name(), \
544
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
545
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
546
} while (0)
547
548
// The RCLCPP_ERROR_FUNCTION macro is surrounded by do { .. } while (0)
549
// to implement the standard C macro idiom to make the macro safe in all
550
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
560
#define RCLCPP_ERROR_FUNCTION(logger, function, ...) \
561
do { \
562
static_assert( \
563
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
564
typename ::rclcpp::Logger>::value, \
565
"First argument to logging macros must be an rclcpp::Logger"); \
566
RCUTILS_LOG_ERROR_FUNCTION_NAMED( \
567
function, \
568
logger.get_name(), \
569
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
570
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
571
} while (0)
572
573
// The RCLCPP_ERROR_SKIPFIRST macro is surrounded by do { .. } while (0)
574
// to implement the standard C macro idiom to make the macro safe in all
575
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
584
#define RCLCPP_ERROR_SKIPFIRST(logger, ...) \
585
do { \
586
static_assert( \
587
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
588
typename ::rclcpp::Logger>::value, \
589
"First argument to logging macros must be an rclcpp::Logger"); \
590
RCUTILS_LOG_ERROR_SKIPFIRST_NAMED( \
591
logger.get_name(), \
592
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
593
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
594
} while (0)
595
596
#endif
597
601
#if (RCLCPP_LOG_MIN_SEVERITY > RCLCPP_LOG_MIN_SEVERITY_FATAL)
603
// empty logging macros for severity FATAL when being disabled at compile time
605
#define RCLCPP_FATAL(...)
606
#define RCLCPP_FATAL_ONCE(...)
608
#define RCLCPP_FATAL_EXPRESSION(...)
610
#define RCLCPP_FATAL_FUNCTION(...)
612
#define RCLCPP_FATAL_SKIPFIRST(...)
614
615
#else
616
// The RCLCPP_FATAL macro is surrounded by do { .. } while (0)
617
// to implement the standard C macro idiom to make the macro safe in all
618
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
626
#define RCLCPP_FATAL(logger, ...) \
627
do { \
628
static_assert( \
629
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
630
typename ::rclcpp::Logger>::value, \
631
"First argument to logging macros must be an rclcpp::Logger"); \
632
RCUTILS_LOG_FATAL_NAMED( \
633
logger.get_name(), \
634
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
635
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
636
} while (0)
637
638
// The RCLCPP_FATAL_ONCE macro is surrounded by do { .. } while (0)
639
// to implement the standard C macro idiom to make the macro safe in all
640
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
649
#define RCLCPP_FATAL_ONCE(logger, ...) \
650
do { \
651
static_assert( \
652
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
653
typename ::rclcpp::Logger>::value, \
654
"First argument to logging macros must be an rclcpp::Logger"); \
655
RCUTILS_LOG_FATAL_ONCE_NAMED( \
656
logger.get_name(), \
657
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
658
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
659
} while (0)
660
661
// The RCLCPP_FATAL_EXPRESSION macro is surrounded by do { .. } while (0)
662
// to implement the standard C macro idiom to make the macro safe in all
663
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
673
#define RCLCPP_FATAL_EXPRESSION(logger, expression, ...) \
674
do { \
675
static_assert( \
676
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
677
typename ::rclcpp::Logger>::value, \
678
"First argument to logging macros must be an rclcpp::Logger"); \
679
RCUTILS_LOG_FATAL_EXPRESSION_NAMED( \
680
expression, \
681
logger.get_name(), \
682
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
683
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
684
} while (0)
685
686
// The RCLCPP_FATAL_FUNCTION macro is surrounded by do { .. } while (0)
687
// to implement the standard C macro idiom to make the macro safe in all
688
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
698
#define RCLCPP_FATAL_FUNCTION(logger, function, ...) \
699
do { \
700
static_assert( \
701
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
702
typename ::rclcpp::Logger>::value, \
703
"First argument to logging macros must be an rclcpp::Logger"); \
704
RCUTILS_LOG_FATAL_FUNCTION_NAMED( \
705
function, \
706
logger.get_name(), \
707
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
708
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
709
} while (0)
710
711
// The RCLCPP_FATAL_SKIPFIRST macro is surrounded by do { .. } while (0)
712
// to implement the standard C macro idiom to make the macro safe in all
713
// contexts; see http://c-faq.com/cpp/multistmt.html for more information.
722
#define RCLCPP_FATAL_SKIPFIRST(logger, ...) \
723
do { \
724
static_assert( \
725
::std::is_same<typename std::remove_reference<typename std::remove_cv<decltype(logger)>::type>::type, \
726
typename ::rclcpp::Logger>::value, \
727
"First argument to logging macros must be an rclcpp::Logger"); \
728
RCUTILS_LOG_FATAL_SKIPFIRST_NAMED( \
729
logger.get_name(), \
730
rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
731
RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
732
} while (0)
733
734
#endif
735
737
738
#endif // RCLCPP__LOGGING_HPP_
logger.hpp
logging_macros.h
utilities.hpp
Generated by
1.8.13