You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/11/18 13:32:27 UTC

[GitHub] [nifi-minifi-cpp] martinzink commented on a diff in pull request #1434: MINIFICPP-1949 ConsumeWindowsEventLog precompiled regex

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


##########
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:
   resubmitted without this change



##########
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:
   resubmitted without this change



##########
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:
   resubmitted without this change



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org