Skip to content

Commit 8c1297b

Browse files
author
Minggang Wang
committed
Call rcl_logging_configure/rcl_logging_fini when init/shutdown
Due to change of ros2/rcl#579, calling rcl_logging_configure/rcl_logging_fini when init/shutdown. Fix #651
1 parent 7b75f0c commit 8c1297b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/rcl_bindings.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <rcl/error_handling.h>
1919
#include <rcl/expand_topic_name.h>
2020
#include <rcl/graph.h>
21+
#include <rcl/logging.h>
2122
#include <rcl/node.h>
2223
#include <rcl/rcl.h>
2324
#include <rcl/validate_topic_name.h>
@@ -98,6 +99,10 @@ NAN_METHOD(Init) {
9899
rcl_init(argc, argc > 0 ? argv : nullptr, &init_options, context),
99100
rcl_get_error_string().str);
100101

102+
THROW_ERROR_IF_NOT_EQUAL(
103+
RCL_RET_OK, rcl_logging_configure(&context->global_arguments, &allocator),
104+
rcl_get_error_string().str);
105+
101106
for (int i = 0; i < argc; i++) {
102107
free(argv[i]);
103108
}
@@ -1253,6 +1258,8 @@ NAN_METHOD(Shutdown) {
12531258
reinterpret_cast<rcl_context_t*>(context_handle->ptr());
12541259
THROW_ERROR_IF_NOT_EQUAL(rcl_shutdown(context), RCL_RET_OK,
12551260
rcl_get_error_string().str);
1261+
THROW_ERROR_IF_NOT_EQUAL(rcl_logging_fini(), RCL_RET_OK,
1262+
rcl_get_error_string().str);
12561263

12571264
if (g_sigint_gc) {
12581265
THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, rcl_guard_condition_fini(g_sigint_gc),

0 commit comments

Comments
 (0)