1'use strict'; 2 3$(function () { 4 if (!window.wakanda) { 5 window.wakanda = {}; 6 } 7 8 if (!window.wakanda.logentry) { 9 var logentry = { 10 aiUrl: logContext.analyticsApiUrl, 11 entries: logContext.actions || [], 12 log: function (category, severity, verb, message, 13 nounType1, nounId1, nounType2, nounId2, customData) { 14 var logEntry = logContext.logEntry, 15 entry = { 16 application: logEntry.application, 17 category: category, 18 userId: logContext.userId || logContext.anonymousId, 19 url: location.href, 20 referer: logEntry.referer, 21 ipAddress: logEntry.ipAddress, 22 userAgent: logEntry.userAgent, 23 actionDate: new Date(), 24 severity: severity, 25 verb: verb, 26 message: message || null, 27 nounType1: nounType1 || null, 28 nounId1: nounId1 || null, 29 nounType2: nounType2 || null, 30 nounId2: nounId2 || null, 31 customData: customData || null 32 }; 33 34 var entries = [entry]; 35 this.logAll(entries); 36 }, 37 logAll: function (entries) { 38 entries = entries || []; 39 if (entries.length === 0) { 40 return; 41 } 42 43 try { 44 var xhr = new XMLHttpRequest(); 45 46 xhr.open('POST', this.aiUrl + '/log'); 47 xhr.setRequestHeader('Content-Type', 'application/json'); 48 49 xhr.onreadystatechange = function () { 50 if ((xhr.readyState === 4) && (xhr.status >= 200 && xhr.status < 300)) { 51 var event = new CustomEvent('wakanda.notify', { 52 detail: { 53 data: entries, 54 response: xhr.responseText 55 } 56 }); 57 58 document.dispatchEvent(event); 59 } 60 }; 61 62 xhr.onerror = function (jxhr) { 63 console.log({ 64 jxhr: jxhr, 65 data: entries 66 }); 67 }; 68 69 var jsonData = JSON.stringify(entries); 70 xhr.send(jsonData); 71 } 72 catch (e) { 73 console.log({ 74 error: e, 75 data: entries 76 }); 77 } 78 } 79 }; 80 window.wakanda.logentry = logentry; 81 82 console.log('Loading Wakanda Logentry version 1.0.0'); 83 } 84 85 // Send data. 86 window.setTimeout(function () { 87 var logentry = window.wakanda.logentry; 88 logentry.logAll(logentry.entries); 89 }, logContext.initDelay || 500); 90});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.