phrocker commented on a change in pull request #630: MINIFICPP-1006: minor
updates for jni building using win build & correct artifact naming
URL: https://github.com/apache/nifi-minifi-cpp/pull/630#discussion_r317793241
##########
File path: extensions/windows-event-log/wel/MetadataWalker.cpp
##########
@@ -0,0 +1,116 @@
+#include "MetadataWalker.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace wel {
+
+bool MetadataWalker::for_each(pugi::xml_node &node) {
+ // don't shortcut resolution here so that we can log attributes.
+ std::string node_name = node.name();
+ if (node_name == "Data") {
+
+ for (pugi::xml_attribute attr : node.attributes()) {
+
+ if (std::regex_match(attr.name(), regex_)) {
+ std::function<std::string(const std::string &)> idUpdate = [&](const
std::string &input) -> std::string {
+ return resolve_ ? utils::OsUtils::userIdToUsername(input) : input;
+ };
+ updateText(node, attr.name(), std::move(idUpdate));
+
+ }
+ if (std::regex_match(attr.value(), regex_)) {
+ std::function<std::string(const std::string &)> idUpdate = [&](const
std::string &input) -> std::string {
+ return resolve_ ? utils::OsUtils::userIdToUsername(input) : input;
+ };
+ updateText(node, attr.value(), std::move(idUpdate));
+ }
+ }
+ } else if (node_name == "Channel") {
+ std::function<std::string(const std::string &)> channelUpdate = [&](const
std::string &input) -> std::string {
+ return resolve_ ? getEventData(EvtFormatMessageChannel) : input;
+ };
+ updateText(node, node.name(), std::move(channelUpdate));
+ } else if (node_name == "Keywords") {
+ std::function<std::string(const std::string &)> keywordUpdate = [&](const
std::string &input) -> std::string {
+ return resolve_ ? getEventData(EvtFormatMessageKeyword) : input;
+ };
+ updateText(node, node.name(), std::move(keywordUpdate));
+ } else if (node_name == "Level") {
+ std::function<std::string(const std::string &)> levelupdate = [&](const
std::string &input) -> std::string {
+ return resolve_ ? getEventData(EvtFormatMessageLevel) : input;
+ };
+ updateText(node, node.name(), std::move(levelupdate));
+ } else if (node_name == "Opcode") {
+ std::function<std::string(const std::string &)> opcodeUpdate = [&](const
std::string &input) -> std::string {
+ return resolve_ ? getEventData(EvtFormatMessageOpcode) : input;
+ };
+ updateText(node, node.name(), std::move(opcodeUpdate));
+ }
+
+ return true; // continue traversal
+}
+
+std::map<std::string, std::string> MetadataWalker::getFieldValues() const {
+ return fields_values_;
+}
+
+std::string MetadataWalker::to_string(const wchar_t* pChar) {
Review comment:
good point. I moved it from existing code but I agree.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services