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


##########
extensions/windows-event-log/ConsumeWindowsEventLog.cpp:
##########
@@ -657,19 +673,16 @@ void ConsumeWindowsEventLog::refreshTimeZoneData() {
   long tzbias = 0;  // NOLINT long comes from WINDOWS API
   bool dst = false;
   switch (ret) {
-    case TIME_ZONE_ID_INVALID:
-      logger_->log_error("Failed to get timezone information!");
+    case TIME_ZONE_ID_INVALID:logger_->log_error("Failed to get timezone 
information!");

Review Comment:
   I prefer the old format here.



##########
extensions/windows-event-log/ConsumeWindowsEventLog.cpp:
##########
@@ -685,21 +698,27 @@ void ConsumeWindowsEventLog::refreshTimeZoneData() {
   logger_->log_trace("Timezone name: %s, offset: %s", timezone_name_, 
timezone_offset_);
 }
 
-void ConsumeWindowsEventLog::putEventRenderFlowFileToSession(const 
EventRender& eventRender, core::ProcessSession& session) const {
-  auto commitFlowFile = [&] (const std::shared_ptr<core::FlowFile>& flowFile, 
const std::string& content, const std::string& mimeType) {
-    session.writeBuffer(flowFile, content);
-    session.putAttribute(flowFile, core::SpecialFlowAttribute::MIME_TYPE, 
mimeType);
-    session.putAttribute(flowFile, "timezone.name", timezone_name_);
-    session.putAttribute(flowFile, "timezone.offset", timezone_offset_);
-    session.getProvenanceReporter()->receive(flowFile, provenanceUri_, 
getUUIDStr(), "Consume windows event logs", 0ms);
-    session.transfer(flowFile, Success);
-  };
+void ConsumeWindowsEventLog::putEventRenderFlowFileToSession(const 
EventRender& eventRender,
+                                                             
core::ProcessSession& session) const {

Review Comment:
   Here, too



##########
extensions/windows-event-log/ConsumeWindowsEventLog.cpp:
##########
@@ -725,28 +744,24 @@ void 
ConsumeWindowsEventLog::putEventRenderFlowFileToSession(const EventRender&
   }
 }
 
-void ConsumeWindowsEventLog::LogWindowsError(std::string error) const {
+void ConsumeWindowsEventLog::LogWindowsError(const std::string& error) const {
   auto error_id = GetLastError();
   LPVOID lpMsg;
 
   FormatMessage(
-    FORMAT_MESSAGE_ALLOCATE_BUFFER |
-    FORMAT_MESSAGE_FROM_SYSTEM,
-    NULL,
-    error_id,
-    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-    (LPTSTR)&lpMsg,
-    0, NULL);
+      FORMAT_MESSAGE_ALLOCATE_BUFFER |
+          FORMAT_MESSAGE_FROM_SYSTEM,

Review Comment:
   It would be clearer for these to go on the same line. But even better: use 
`std::error_code` instead of `FormatMessage`.



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