1919# ifndef RCUTILS__LOGGING_MACROS_H_
2020# define RCUTILS__LOGGING_MACROS_H_
2121
22+ // * INDENT- OFF*
23+
2224# include "rcutils/logging.h"
2325
2426# include <stdio.h>
@@ -108,7 +110,7 @@ extern "C"
108110 * A macro finalizing the `once` condition.
109111 * /
110112# define RCUTILS_LOG_CONDITION_ONCE_AFTER } \
111- }
113+ }
112114/// @@ }
113115
114116/** @ @ name Macros for the ` expression ` condition which ignores the log calls
@@ -169,7 +171,7 @@ typedef bool (* RclLogFilter)();
169171 * A macro finalizing the ` skipfirst ` condition.
170172 */
171173# define RCUTILS_LOG_CONDITION_SKIPFIRST_AFTER } \
172- }
174+ }
173175/// @@}
174176
175177/** @@name Macros for the `throttle` condition which ignores log calls if the
@@ -181,28 +183,28 @@ typedef bool (* RclLogFilter)();
181183 * A macro initializing and checking the ` throttle ` condition.
182184 */
183185# define RCUTILS_LOG_CONDITION_THROTTLE_BEFORE(get_time_point_value, duration) { \
184- static rcutils_duration_value_t __rcutils_logging_duration = RCUTILS_MS_TO_NS (RCUTILS_CAST_DURATION (duration)); \
185- static rcutils_time_point_value_t __rcutils_logging_last_logged = 0 ; \
186- rcutils_time_point_value_t __rcutils_logging_now = 0 ; \
187- bool __rcutils_logging_condition = true ; \
188- if (get_time_point_value (& __rcutils_logging_now) != RCUTILS_RET_OK) { \
189- rcutils_log ( \
190- & __rcutils_logging_location, RCUTILS_LOG_SEVERITY_ERROR, " " , \
191- " %s() at %s:%d getting current steady time failed\n " , \
192- __func__, __FILE__, __LINE__); \
193- } else { \
194- __rcutils_logging_condition = __rcutils_logging_now >= __rcutils_logging_last_logged + __rcutils_logging_duration; \
195- } \
186+ static rcutils_duration_value_t __rcutils_logging_duration = RCUTILS_MS_TO_NS (RCUTILS_CAST_DURATION (duration)); \
187+ static rcutils_time_point_value_t __rcutils_logging_last_logged = 0 ; \
188+ rcutils_time_point_value_t __rcutils_logging_now = 0 ; \
189+ bool __rcutils_logging_condition = true ; \
190+ if (get_time_point_value (& __rcutils_logging_now) != RCUTILS_RET_OK) { \
191+ rcutils_log ( \
192+ & __rcutils_logging_location, RCUTILS_LOG_SEVERITY_ERROR, " " , \
193+ " %s() at %s:%d getting current steady time failed\n " , \
194+ __func__, __FILE__, __LINE__); \
195+ } else { \
196+ __rcutils_logging_condition = __rcutils_logging_now >= __rcutils_logging_last_logged + __rcutils_logging_duration; \
197+ } \
196198 \
197- if (RCUTILS_LIKELY (__rcutils_logging_condition)) { \
198- __rcutils_logging_last_logged = __rcutils_logging_now;
199+ if (RCUTILS_LIKELY (__rcutils_logging_condition)) { \
200+ __rcutils_logging_last_logged = __rcutils_logging_now;
199201
200202/**
201203 * \def RCUTILS_LOG_CONDITION_THROTTLE_AFTER
202204 * A macro finalizing the ` throttle ` condition.
203205 */
204206# define RCUTILS_LOG_CONDITION_THROTTLE_AFTER } \
205- }
207+ }
206208/// @@}
207209
208210@{
@@ -257,6 +259,8 @@ from rcutils.logging import severities
257259# endif
258260/// @@ }
259261
262+ // * INDENT- ON*
263+
260264@ [end for ]@
261265# ifdef __cplusplus
262266}
0 commit comments