martinzink commented on code in PR #1670:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1670#discussion_r1343627366
##########
libminifi/src/c2/C2Agent.cpp:
##########
@@ -151,16 +151,16 @@ void C2Agent::configure(const std::shared_ptr<Configure>
&configure, bool reconf
if (!configure->get(Configuration::nifi_c2_agent_protocol_class,
"c2.agent.protocol.class", clazz)) {
clazz = "RESTSender";
}
- logger_->log_info("Class is %s", clazz);
+ logger_->log_info("Class is {}", clazz);
auto protocol =
core::ClassLoader::getDefaultClassLoader().instantiateRaw(clazz, clazz);
if (protocol == nullptr) {
- logger_->log_warn("Class %s not found", clazz);
+ logger_->log_warn("Class {} not found", clazz);
protocol =
core::ClassLoader::getDefaultClassLoader().instantiateRaw("RESTSender",
"RESTSender");
if (!protocol) {
- const char* errmsg = "Attempted to load RESTSender. To enable C2,
please specify an active protocol for this agent.";
- logger_->log_error(errmsg);
- throw Exception{ GENERAL_EXCEPTION, errmsg };
+ constexpr std::string_view errmsg = "Attempted to load RESTSender. To
enable C2, please specify an active protocol for this agent.";
+ logger_->log_error("{}", errmsg);
+ throw Exception{ GENERAL_EXCEPTION, std::string(errmsg) };
Review Comment:
Eventhough we create this string_view 2 lines before it and thus know that
it is null terminated, the data() call still looks out of place. how about
https://github.com/apache/nifi-minifi-cpp/pull/1670/commits/8ccc0133b978380101d7ec0a2c4e67a4401b1902
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]