szaszm commented on code in PR #1810:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1810#discussion_r1631192143


##########
extensions/standard-processors/processors/LogAttribute.cpp:
##########
@@ -48,98 +49,93 @@ void LogAttribute::onSchedule(core::ProcessContext& 
context, core::ProcessSessio
 
   context.getProperty(MaxPayloadLineLength, max_line_length_);
   logger_->log_debug("Maximum Payload Line Length: {}", max_line_length_);
-}
-// OnTrigger method, implemented by NiFi LogAttribute
-void LogAttribute::onTrigger(core::ProcessContext& context, 
core::ProcessSession& session) {
-  logger_->log_trace("enter log attribute, attempting to retrieve {} flow 
files", flowfiles_to_log_);
-  std::string dashLine = "--------------------------------------------------";
-  LogAttrLevel level = LogAttrLevelInfo;
-  bool logPayload = false;
 
-  uint64_t i = 0;
-  const auto max = flowfiles_to_log_ == 0 ? UINT64_MAX : flowfiles_to_log_;
-  for (; i < max; ++i) {
-    std::shared_ptr<core::FlowFile> flow = session.get();
+  if (auto attributes_to_log_str = context.getProperty(AttributesToLog); 
attributes_to_log_str && !attributes_to_log_str->empty()) {
+    if (auto attrs_to_log_vec = utils::string::split(*attributes_to_log_str, 
","); !attrs_to_log_vec.empty())
+      
attributes_to_log_.emplace(std::make_move_iterator(attrs_to_log_vec.begin()), 
std::make_move_iterator(attrs_to_log_vec.end()));
+  }
 
-    if (!flow) {
-      break;
-    }
+  if (auto attributes_to_ignore_str = context.getProperty(AttributesToIgnore); 
attributes_to_ignore_str && !attributes_to_ignore_str->empty()) {
+    if (auto attrs_to_ignore_vec = 
utils::string::split(*attributes_to_ignore_str, ","); 
!attrs_to_ignore_vec.empty())
+      
attributes_to_ignore_.emplace(std::make_move_iterator(attrs_to_ignore_vec.begin()),
 std::make_move_iterator(attrs_to_ignore_vec.end()));
+  }
 
-    std::string value;
-    if (context.getProperty(LogLevel, value)) {
-      logLevelStringToEnum(value, level);
-    }
-    if (context.getProperty(LogPrefix, value)) {
-      dashLine = "-----" + value + "-----";
+  if (auto log_level_str = context.getProperty(LogLevel)) {
+    if (auto result = 
magic_enum::enum_cast<core::logging::LOG_LEVEL>(*log_level_str)) {
+      log_level_ = *result;
+    } else if (*log_level_str == "error") {  // TODO(MINIFICPP-2294) this 
could be avoided if config files were properly migrated

Review Comment:
   Can we change the log level name to "error" instead, without breaking stuff? 
full words > half word here IMO



-- 
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]

Reply via email to