Jyyjy commented on issue #266: URL: https://github.com/apache/incubator-flagon-useralejs/issues/266#issuecomment-1300964306
I am working with @poorejc on adding this feature. I started with @EandrewJones buildDatasets() function. I tested it, it worked, and then there was a discussion on what information we actually want in the log messages. Right now this is where we are at: - We want all attributes, not just dataset attributes. - We only want attributes of the event target. - We want to parse JSON values I wanted to share this code snippet that does the above, and see what others think should be included in a log. ` /** * Builds an object containing all attributes of an element. * Attempts to parse all attribute values as JSON text. * @param {Object} e Event from which the attributes should be extracted from. * @return {Object} Object with all element attributes as key value pairs. */ export function buildAttrs(e) { let attributes = {}; if(e.target && e.target instanceof Element) { let i = 0; let attrs = e.target.attributes; while(i < attrs.length) { let val = attrs[i].value; try { val = JSON.parse(val); } catch (error) {} attributes[attrs[i].name] = val; i++; } } return attributes; } ` -- 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: dev-unsubscr...@flagon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org