Skip to content

Commit 60897ca

Browse files
committed
more pr comments
1 parent 2607f84 commit 60897ca

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/viam/sdk/common/utils.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,22 @@ ProtoStruct debug_map(std::string debug_key) {
135135
return map;
136136
}
137137

138-
ProtoStruct add_debug_entry(ProtoStruct&& map, std::string debug_key) {
138+
void add_debug_entry(ProtoStruct& map, std::string debug_key) {
139139
map.emplace(impl::debug_map_key, ProtoValue(std::move(debug_key)));
140+
}
141+
142+
void add_debug_entry(ProtoStruct& map) {
143+
add_debug_entry(map, random_debug_key());
144+
}
145+
146+
ProtoStruct with_debug_entry(ProtoStruct&& map, std::string debug_key) {
147+
add_debug_entry(map, std::move(debug_key));
140148
return map;
141149
}
142150

143151
ProtoStruct add_debug_entry(ProtoStruct&& map) {
144-
return add_debug_entry(std::move(map), random_debug_key());
152+
add_debug_entry(map);
153+
return map;
145154
}
146155

147156
void ClientContext::set_debug_key(const std::string& debug_key) {

src/viam/sdk/common/utils.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,19 @@ ProtoStruct debug_map(std::string debug_key);
7070

7171
/// @brief Adds @param debug_key for server-side debug logging to @param map
7272
/// @throws Exception if the debug_key contains invalid (e.g., uppercase) gRPC characters
73-
ProtoStruct add_debug_entry(ProtoStruct&& map, std::string debug_key);
73+
void add_debug_entry(ProtoStruct& map, std::string debug_key);
7474

7575
/// @brief Adds a random key to @param map for server-side debug logging
76-
ProtoStruct add_debug_entry(ProtoStruct&& map);
76+
void add_debug_entry(ProtoStruct& map);
77+
78+
/// @brief Adds @param debug_key for server-side debug logging to @param map
79+
/// @throws Exception if the debug_key contains invalid (e.g., uppercase) gRPC characters
80+
/// @returns the new ProtoStruct
81+
ProtoStruct with_debug_entry(ProtoStruct&& map, std::string debug_key);
82+
83+
/// @brief Adds a random key to @param map for server-side debug logging
84+
/// @returns the new ProtoStruct
85+
ProtoStruct with_debug_entry(ProtoStruct&& map);
7786

7887
/// @brief Set the boost trivial logger's severity depending on args.
7988
/// @param argc The number of args.

0 commit comments

Comments
 (0)