@@ -44,13 +44,6 @@ struct log_channel_config {
4444 bool should_print_context = false ;
4545};
4646
47- // / Strong type to wrap a constant log label that is prepended to each log message.
48- struct log_label_t {
49- // / Optional log label. If set, will get printed in front of each log message.
50- // / Disabled by default.
51- std::string log_label;
52- };
53-
5447// / A log channel is the entity used for logging messages.
5548// /
5649// / It can deliver a log entry to one or more different sinks, for example a
@@ -146,7 +139,7 @@ class log_channel
146139 // / Builds the provided log entry and passes it to the backend. When the
147140 // / channel is disabled the log entry will be discarded.
148141 template <typename ... Args>
149- void operator ()(const log_label_t & label , const char * fmtstr, Args&&... args)
142+ void operator ()(std::shared_ptr< const std::string> log_label , const char * fmtstr, Args&&... args)
150143 {
151144 if (!enabled ()) {
152145 return ;
@@ -171,7 +164,7 @@ class log_channel
171164 store,
172165 log_name,
173166 log_tag,
174- label. log_label }};
167+ std::move ( log_label) }};
175168 backend.push (std::move (entry));
176169 }
177170
@@ -247,7 +240,11 @@ class log_channel
247240 // / Builds the provided log entry and passes it to the backend. When the
248241 // / channel is disabled the log entry will be discarded.
249242 template <typename ... Args>
250- void operator ()(const log_label_t & label, const uint8_t * buffer, size_t len, const char * fmtstr, Args&&... args)
243+ void operator ()(std::shared_ptr<const std::string> log_label,
244+ const uint8_t * buffer,
245+ size_t len,
246+ const char * fmtstr,
247+ Args&&... args)
251248 {
252249 if (!enabled ()) {
253250 return ;
@@ -277,7 +274,7 @@ class log_channel
277274 store,
278275 log_name,
279276 log_tag,
280- label. log_label ,
277+ std::move ( log_label) ,
281278 std::vector<uint8_t >(buffer, buffer + len)}};
282279 backend.push (std::move (entry));
283280 }
@@ -361,7 +358,8 @@ class log_channel
361358 // / Builds the provided log entry and passes it to the backend. When the
362359 // / channel is disabled the log entry will be discarded.
363360 template <typename It, typename ... Args, typename std::enable_if<detail::is_byte_iterable<It>::value, int >::type = 0 >
364- void operator ()(const log_label_t & label, It it_begin, It it_end, const char * fmtstr, Args&&... args)
361+ void
362+ operator ()(std::shared_ptr<const std::string> log_label, It it_begin, It it_end, const char * fmtstr, Args&&... args)
365363 {
366364 if (!enabled ()) {
367365 return ;
@@ -391,7 +389,7 @@ class log_channel
391389 store,
392390 log_name,
393391 log_tag,
394- label. log_label ,
392+ std::move ( log_label) ,
395393 std::vector<uint8_t >(it_begin, it_end)}};
396394 backend.push (std::move (entry));
397395 }
0 commit comments