File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,8 @@ BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE(attr_time,
150150// / @ingroup Log
151151// /
152152// / Use this macro to generate log messages pertaining to the SDK at large.
153+ // / @warning Using this macro outside of the lifetime of LogManager is UB and for this reason
154+ // / logging in destructors should be done with caution or avoided entirely.
153155#define VIAM_SDK_LOG (level ) VIAM_SDK_LOG_IMPL(::viam::sdk::LogManager::get().global_logger(), level)
154156
155157// / @brief Log macro for resource-level logs.
@@ -158,6 +160,8 @@ BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE(attr_time,
158160// / This macro can only be called from the definition of a member function of a class inheriting
159161// / @ref Resource. It will log messages to the log source of that specific resource, allowing
160162// / resource-level log filtering.
163+ // / @warning Using this macro outside of the lifetime of LogManager is UB and for this reason
164+ // / logging in destructors should be done with caution or avoided entirely.
161165#define VIAM_RESOURCE_LOG (level ) VIAM_SDK_LOG_IMPL(this ->logger_, level)
162166
163167} // namespace sdk
Original file line number Diff line number Diff line change @@ -254,15 +254,14 @@ ModuleService::ModuleService(int argc,
254254}
255255
256256ModuleService::~ModuleService () {
257- // TODO(RSDK-5509): Run registered cleanup functions here.
258- VIAM_SDK_LOG (info) << " Shutting down gracefully." ;
257+ std::cout << " Shutting down gracefully." ;
259258 server_->shutdown ();
260259
261260 if (parent_) {
262261 try {
263262 parent_->close ();
264263 } catch (const std::exception& exc) {
265- VIAM_SDK_LOG (error) << exc.what ();
264+ std::cerr << exc.what ();
266265 }
267266 }
268267}
Original file line number Diff line number Diff line change @@ -120,9 +120,9 @@ RobotClient::~RobotClient() {
120120 try {
121121 this ->close ();
122122 } catch (const std::exception& e) {
123- VIAM_SDK_LOG (error) << " Received err while closing RobotClient: " << e.what ();
123+ std::cerr << " Received err while closing RobotClient: " << e.what ();
124124 } catch (...) {
125- VIAM_SDK_LOG (error) << " Received unknown err while closing RobotClient" ;
125+ std::cerr << " Received unknown err while closing RobotClient" ;
126126 }
127127 }
128128}
You can’t perform that action at this time.
0 commit comments