From 763c3e70e2a18de4944da31ede677c7e973a09cc Mon Sep 17 00:00:00 2001 From: Thomas Ardal Date: Tue, 23 Oct 2018 15:32:00 +0200 Subject: [PATCH] Upgraded samples to beta2 --- .../ClientApp/package-lock.json | 6 +- .../ClientApp/package.json | 2 +- .../Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc.csproj | 2 + .../Elmah.Io.Js.Mvc/Scripts/elmahio.js | 84 ++++++++++++------- .../Elmah.Io.Js.Mvc/Scripts/elmahio.js.map | 1 + .../Elmah.Io.Js.Mvc/Scripts/elmahio.min.js | 4 +- .../Scripts/elmahio.min.js.map | 1 + 7 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js.map create mode 100644 samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js.map diff --git a/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package-lock.json b/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package-lock.json index f57803e..423d0b0 100644 --- a/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package-lock.json +++ b/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package-lock.json @@ -2784,9 +2784,9 @@ } }, "elmah.io.js": { - "version": "3.0.0-beta1", - "resolved": "https://registry.npmjs.org/elmah.io.js/-/elmah.io.js-3.0.0-beta1.tgz", - "integrity": "sha512-3HZEFbWDAC99BmNzRPyJSA2aFVJG9wV0Ony0yppN9D3Qj7v+7gIITrj2dS6nKmt2visWgWOJRADJjrLOSV4Vvg==" + "version": "3.0.0-beta2", + "resolved": "https://registry.npmjs.org/elmah.io.js/-/elmah.io.js-3.0.0-beta2.tgz", + "integrity": "sha512-6m1YzuuHoEp5Haob1BmKDFHzwWKFu5r7pv8hwds7Fb6EJ2T5TbeRRo5Wclri58IUS3pu8LbuVzx1Y+xXrZLDEQ==" }, "ember-cli-string-utils": { "version": "1.1.0", diff --git a/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package.json b/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package.json index bf92a6f..b5c1402 100644 --- a/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package.json +++ b/samples/Elmah.Io.Js.Angular/Elmah.Io.Js.Angular/ClientApp/package.json @@ -29,7 +29,7 @@ "core-js": "^2.4.1", "rxjs": "^5.5.6", "zone.js": "^0.8.19", - "elmah.io.js": "3.0.0-beta1" + "elmah.io.js": "3.0.0-beta2" }, "devDependencies": { "@angular/cli": "~1.7.0", diff --git a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc.csproj b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc.csproj index cc11330..5053ee6 100644 --- a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc.csproj +++ b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc.csproj @@ -167,6 +167,8 @@ PreserveNewest + + diff --git a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js index 9d113af..9d37b88 100644 --- a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js +++ b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js @@ -1,5 +1,5 @@ /*! - * elmah.io Javascript Logger - version 3.0.0-beta1 + * elmah.io Javascript Logger - version 3.0.0-beta2 * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io */ (function(root, factory) { @@ -33,9 +33,7 @@ logId: null, debug: false, application: null, - onMessage: null, - onError: null, - onFilter: null + filter: null }; var extend = function() { var extended = {}; @@ -69,7 +67,7 @@ var Pairs = query.split(/[;&]/); for (var i = 0; i < Pairs.length; i++) { var KeyVal = Pairs[i].split('='); - if (!KeyVal || KeyVal.length != 2) continue; + if (!KeyVal || KeyVal.length !== 2) continue; var key = unescape(KeyVal[0]); var val = unescape(KeyVal[1]); val = val.replace(/\+/g, ' '); @@ -89,7 +87,7 @@ function getSearchParameters() { var prmstr = window.location.search.substr(1); - return prmstr != null && prmstr != "" ? transformToAssocArray(prmstr) : {}; + return prmstr !== null && prmstr !== "" ? transformToAssocArray(prmstr) : {}; } function transformToAssocArray(prmstr) { @@ -107,11 +105,11 @@ function merge_objects(obj1, obj2) { var obj3 = {}; - for (var attrname in obj1) { - obj3[attrname] = obj1[attrname]; + for (var attrname1 in obj1) { + obj3[attrname1] = obj1[attrname1]; } - for (var attrname in obj2) { - obj3[attrname] = obj2[attrname]; + for (var attrname2 in obj2) { + obj3[attrname2] = obj2[attrname2]; } return obj3; } @@ -266,7 +264,7 @@ function getPayload() { var payload = { - "url": [document.location.protocol, '//', document.location.host, document.location.pathname, document.location.hash].join('') || '/', + "url": document.location.pathname || '/', "application": settings.application }; var payload_data = []; @@ -286,7 +284,7 @@ "key": "Browser-Height", "value": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight }); - if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) != undefined) payload_data.push({ + if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ "key": "Screen-Orientation", "value": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split("-"))[0] }); @@ -316,6 +314,14 @@ "key": "Referer", "value": document.referrer }); + if (document.location.protocol === "https:") payload_serverVariables.push({ + "key": "HTTPS", + "value": 'on' + }); + if (document.location.hostname) payload_serverVariables.push({ + "key": "Host", + "value": document.location.hostname + }); payload.serverVariables = payload_serverVariables; return payload; } @@ -324,8 +330,10 @@ if (settings.debug) { if (status === 'error') { console.log('%c \u2BC8 Error log: ' + '%c \u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS); - } else { + } else if (status === 'success') { console.log('%c \u2BC8 Error log: ' + '%c \u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS); + } else { + console.log('%c \u2BC8 Error log: ' + '%c \u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS); } } } @@ -352,29 +360,25 @@ }; xhr.onerror = function(e) { callback('error', xhr.statusText); - if (settings.onError !== null) { - settings.onError(xhr.status, xhr.statusText); - } + publicAPIs.emit('error', xhr.status, xhr.statusText); } var stack = ErrorStackParser(settings).parse(error.error); var jsonData = { "detail": error.error.stack, - "title": error.message, + "title": error.message || 'Unspecified error', "source": stack && stack.length > 0 ? stack[0].fileName : null, "severity": "Error", "type": error.error.name, "queryString": JSON.parse(JSON.stringify(queryParams)) }; jsonData = merge_objects(jsonData, getPayload()); - if (settings.onFilter !== null) { - if (settings.onFilter(jsonData)) { + if (settings.filter !== null) { + if (settings.filter(jsonData)) { send = 0; } } - if (settings.onMessage !== null) { - settings.onMessage(jsonData); - } if (send === 1) { + publicAPIs.emit('message', jsonData); xhr.send(JSON.stringify(jsonData)); } } else { @@ -406,9 +410,7 @@ }; xhr.onerror = function(e) { callback('error', xhr.statusText); - if (settings.onError !== null) { - settings.onError(xhr.status, xhr.statusText); - } + publicAPIs.emit('error', xhr.status, xhr.statusText); } if (type !== "Log") { var stack = error ? ErrorStackParser(settings).parse(error) : null; @@ -424,16 +426,18 @@ } else { jsonData = error; } - if (settings.onFilter !== null) { - if (settings.onFilter(jsonData)) { + if (settings.filter !== null) { + if (settings.filter(jsonData)) { send = 0; } } - if (settings.onMessage !== null) { - settings.onMessage(jsonData); - } if (send === 1) { - xhr.send(JSON.stringify(jsonData)); + if (jsonData.title) { + publicAPIs.emit('message', jsonData); + xhr.send(JSON.stringify(jsonData)); + } else { + callback('missing-title', xhr.statusText); + } } } else { return console.log('Login api error'); @@ -478,6 +482,24 @@ publicAPIs.log = function(obj) { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj); }; + publicAPIs.on = function(name, callback, ctx) { + var e = this.e || (this.e = {}); + (e[name] || (e[name] = [])).push({ + fn: callback, + ctx: ctx + }); + return this; + }; + publicAPIs.emit = function(name) { + var data = [].slice.call(arguments, 1); + var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); + var i = 0; + var len = evtArr.length; + for (i; i < len; i++) { + evtArr[i].fn.apply(evtArr[i].ctx, data); + } + return this; + }; publicAPIs.init = function(options) { settings = extend(defaults, options || {}); window.onerror = function(message, source, lineno, colno, error) { diff --git a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js.map b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js.map new file mode 100644 index 0000000..2f3fe7a --- /dev/null +++ b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"mappings":"","sources":["elmahio.js"],"sourcesContent":["/*!\r\n * elmah.io Javascript Logger - version 3.0.0-beta2\r\n * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io\r\n */\r\n(function (root, factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n define([], function () {\r\n return factory(root);\r\n });\r\n } else if (typeof exports === 'object') {\r\n module.exports = factory(root);\r\n } else {\r\n root.Elmahio = factory(root);\r\n }\r\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) {\r\n\r\n 'use strict';\r\n\r\n //\r\n // Shared Variables\r\n //\r\n\r\n var scriptFile = document.getElementsByTagName('script');\r\n var scriptIndex = scriptFile.length - 1;\r\n var myScript = scriptFile[scriptIndex];\r\n var queryString = myScript.src.replace(/^[^\\?]+\\??/, '');\r\n var params = parseQuery(queryString);\r\n var paramsLength = objectLength(params);\r\n\r\n var debugSettings = {\r\n label: ' elmah.io debugger : On ',\r\n labelCSS: 'background: #06a89c; color: #ffffff; display: inline-block; font-size: 14px;',\r\n successCSS: 'background: #d4edda; color: #155724; display: inline-block; font-size: 13px;',\r\n errorCSS: 'background: #f8d7da; color: #721c24; display: inline-block; font-size: 13px;',\r\n warningCSS: 'background: #fff3cd; color: #856404; display: inline-block; font-size: 13px;',\r\n lightCSS: 'background: #e2e3e5; color: #383d41; display: inline-block; font-size: 13px;'\r\n };\r\n\r\n var defaults = {\r\n apiKey: null,\r\n logId: null,\r\n debug: false,\r\n application: null,\r\n filter: null\r\n };\r\n\r\n //\r\n // Shared Methods\r\n //\r\n\r\n var extend = function () {\r\n\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n\r\n // Check if a deep merge\r\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\r\n deep = arguments[0];\r\n i++;\r\n }\r\n\r\n // Merge the object into the extended object\r\n var merge = function (obj) {\r\n for (var prop in obj) {\r\n if (obj.hasOwnProperty(prop)) {\r\n // If property is an object, merge properties\r\n if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\r\n extended[prop] = extend(extended[prop], obj[prop]);\r\n } else {\r\n extended[prop] = obj[prop];\r\n }\r\n }\r\n }\r\n };\r\n\r\n // Loop through each object and conduct a merge\r\n for (; i < arguments.length; i++) {\r\n var obj = arguments[i];\r\n merge(obj);\r\n }\r\n\r\n return extended;\r\n\r\n };\r\n\r\n //\r\n // Helpers\r\n //\r\n\r\n function parseQuery(query) {\r\n var Params = new Object();\r\n if (!query) return Params; // return empty object\r\n var Pairs = query.split(/[;&]/);\r\n for (var i = 0; i < Pairs.length; i++) {\r\n var KeyVal = Pairs[i].split('=');\r\n if (!KeyVal || KeyVal.length !== 2) continue;\r\n var key = unescape(KeyVal[0]);\r\n var val = unescape(KeyVal[1]);\r\n val = val.replace(/\\+/g, ' ');\r\n Params[key] = val;\r\n }\r\n return Params;\r\n }\r\n\r\n function objectLength(obj) {\r\n var size = 0, key;\r\n for (key in obj) {\r\n if (obj.hasOwnProperty(key)) size++;\r\n }\r\n return size;\r\n };\r\n\r\n function getSearchParameters() {\r\n var prmstr = window.location.search.substr(1);\r\n return prmstr !== null && prmstr !== \"\" ? transformToAssocArray(prmstr) : {};\r\n }\r\n\r\n function transformToAssocArray(prmstr) {\r\n var params = [];\r\n var prmarr = prmstr.split(\"&\");\r\n for (var i = 0; i < prmarr.length; i++) {\r\n var tmparr = prmarr[i].split(\"=\");\r\n params.push({\r\n 'key': tmparr[0],\r\n 'value': tmparr[1]\r\n });\r\n }\r\n return params;\r\n }\r\n\r\n function merge_objects(obj1, obj2) {\r\n var obj3 = {};\r\n for (var attrname1 in obj1) {\r\n obj3[attrname1] = obj1[attrname1];\r\n }\r\n for (var attrname2 in obj2) {\r\n obj3[attrname2] = obj2[attrname2];\r\n }\r\n\r\n return obj3;\r\n }\r\n\r\n function ErrorStackParser(settings) {\r\n 'use strict';\r\n\r\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+\\:\\d+/;\r\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+\\:\\d+|\\(native\\))/m;\r\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code\\])?$/;\r\n\r\n return {\r\n parse: function (error) {\r\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\r\n return this.parseOpera(error);\r\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\r\n return this.parseV8OrIE(error);\r\n } else if (error.stack) {\r\n return this.parseFFOrSafari(error);\r\n } else if (settings.debug) {\r\n console.log('%c Cannot parse given Error object', debugSettings.warningCSS);\r\n } else {\r\n return null;\r\n }\r\n },\r\n\r\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\r\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\r\n // Fail-fast but return locations like \"(native)\"\r\n if (urlLike.indexOf(':') === -1) {\r\n return [urlLike];\r\n }\r\n\r\n var regExp = /(.+?)(?:\\:(\\d+))?(?:\\:(\\d+))?$/;\r\n var parts = regExp.exec(urlLike.replace(/[\\(\\)]/g, ''));\r\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\r\n },\r\n\r\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\r\n var filtered = error.stack.split('\\n').filter(function (line) {\r\n return !!line.match(CHROME_IE_STACK_REGEXP);\r\n }, this);\r\n\r\n return filtered.map(function (line) {\r\n if (line.indexOf('(eval ') > -1) {\r\n // Throw away eval information until we implement stacktrace.js/stackframe#8\r\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^\\()]*)|(\\)\\,.*$)/g, '');\r\n }\r\n var tokens = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').split(/\\s+/).slice(1);\r\n var locationParts = this.extractLocation(tokens.pop());\r\n var functionName = tokens.join(' ') || undefined;\r\n var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\r\n\r\n return ({\r\n functionName: functionName,\r\n fileName: fileName,\r\n lineNumber: locationParts[1],\r\n columnNumber: locationParts[2],\r\n source: line\r\n });\r\n }, this);\r\n },\r\n\r\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\r\n var filtered = error.stack.split('\\n').filter(function (line) {\r\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\r\n }, this);\r\n\r\n return filtered.map(function (line) {\r\n // Throw away eval information until we implement stacktrace.js/stackframe#8\r\n if (line.indexOf(' > eval') > -1) {\r\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval\\:\\d+\\:\\d+/g, ':$1');\r\n }\r\n\r\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\r\n // Safari eval frames only have function names and nothing else\r\n return ({\r\n functionName: line\r\n });\r\n } else {\r\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\r\n var matches = line.match(functionNameRegex);\r\n var functionName = matches && matches[1] ? matches[1] : undefined;\r\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\r\n\r\n return ({\r\n functionName: functionName,\r\n fileName: locationParts[0],\r\n lineNumber: locationParts[1],\r\n columnNumber: locationParts[2],\r\n source: line\r\n });\r\n }\r\n }, this);\r\n },\r\n\r\n parseOpera: function ErrorStackParser$$parseOpera(e) {\r\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\r\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\r\n return this.parseOpera9(e);\r\n } else if (!e.stack) {\r\n return this.parseOpera10(e);\r\n } else {\r\n return this.parseOpera11(e);\r\n }\r\n },\r\n\r\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\r\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\r\n var lines = e.message.split('\\n');\r\n var result = [];\r\n\r\n for (var i = 2, len = lines.length; i < len; i += 2) {\r\n var match = lineRE.exec(lines[i]);\r\n if (match) {\r\n result.push(({\r\n fileName: match[2],\r\n lineNumber: match[1],\r\n source: lines[i]\r\n }));\r\n }\r\n }\r\n\r\n return result;\r\n },\r\n\r\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\r\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\r\n var lines = e.stacktrace.split('\\n');\r\n var result = [];\r\n\r\n for (var i = 0, len = lines.length; i < len; i += 2) {\r\n var match = lineRE.exec(lines[i]);\r\n if (match) {\r\n result.push(\r\n ({\r\n functionName: match[3] || undefined,\r\n fileName: match[2],\r\n lineNumber: match[1],\r\n source: lines[i]\r\n })\r\n );\r\n }\r\n }\r\n\r\n return result;\r\n },\r\n\r\n // Opera 10.65+ Error.stack very similar to FF/Safari\r\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\r\n var filtered = error.stack.split('\\n').filter(function (line) {\r\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\r\n }, this);\r\n\r\n return filtered.map(function (line) {\r\n var tokens = line.split('@');\r\n var locationParts = this.extractLocation(tokens.pop());\r\n var functionCall = (tokens.shift() || '');\r\n var functionName = functionCall\r\n .replace(//, '$2')\r\n .replace(/\\([^\\)]*\\)/g, '') || undefined;\r\n var argsRaw;\r\n if (functionCall.match(/\\(([^\\)]*)\\)/)) {\r\n argsRaw = functionCall.replace(/^[^\\(]+\\(([^\\)]*)\\)$/, '$1');\r\n }\r\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\r\n undefined : argsRaw.split(',');\r\n\r\n return ({\r\n functionName: functionName,\r\n args: args,\r\n fileName: locationParts[0],\r\n lineNumber: locationParts[1],\r\n columnNumber: locationParts[2],\r\n source: line\r\n });\r\n }, this);\r\n }\r\n };\r\n\r\n }\r\n\r\n\r\n //\r\n // Constructor\r\n // Can be named anything you want\r\n //\r\n\r\n var Constructor = function (options) {\r\n\r\n //\r\n // Unique Variables\r\n //\r\n\r\n var publicAPIs = {};\r\n var settings;\r\n\r\n function getPayload() {\r\n var payload = {\r\n \"url\": document.location.pathname || '/',\r\n \"application\": settings.application\r\n };\r\n\r\n var payload_data = [];\r\n\r\n if (navigator.language) payload_data.push({ \"key\": \"User-Language\", \"value\": navigator.language });\r\n if (document.documentMode) payload_data.push({ \"key\": \"Document-Mode\", \"value\": document.documentMode });\r\n if (window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth) payload_data.push({ \"key\": \"Browser-Width\", \"value\": window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth });\r\n if (window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight) payload_data.push({ \"key\": \"Browser-Height\", \"value\": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight });\r\n if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ \"key\": \"Screen-Orientation\", \"value\": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split(\"-\"))[0] });\r\n if (screen.width) payload_data.push({ \"key\": \"Screen-Width\", \"value\": screen.width });\r\n if (screen.height) payload_data.push({ \"key\": \"Screen-Height\", \"value\": screen.height });\r\n if (screen.colorDepth) payload_data.push({ \"key\": \"Color-Depth\", \"value\": screen.colorDepth });\r\n payload_data.push({ \"key\": \"X-ELMAHIO-SEARCH-isClientside\", \"value\": \"true\" });\r\n\r\n payload.data = payload_data;\r\n\r\n var payload_serverVariables = [];\r\n if (navigator.userAgent) payload_serverVariables.push({ \"key\": \"User-Agent\", \"value\": navigator.userAgent });\r\n if (document.referrer) payload_serverVariables.push({ \"key\": \"Referer\", \"value\": document.referrer });\r\n if (document.location.protocol === \"https:\") payload_serverVariables.push({ \"key\": \"HTTPS\", \"value\": 'on' });\r\n if (document.location.hostname) payload_serverVariables.push({ \"key\": \"Host\", \"value\": document.location.hostname });\r\n\r\n payload.serverVariables = payload_serverVariables;\r\n\r\n return payload;\r\n }\r\n\r\n function confirmResponse(status, response) {\r\n if (settings.debug) {\r\n if (status === 'error') {\r\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS);\r\n } else if (status === 'success') {\r\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS);\r\n } else {\r\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS);\r\n }\r\n }\r\n }\r\n\r\n // Private methods\r\n\r\n var sendPayload = function (apiKey, logId, callback, errorLog) {\r\n var api_key = apiKey,\r\n log_id = logId,\r\n error = errorLog,\r\n send = 1,\r\n queryParams = getSearchParameters();\r\n\r\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\r\n\r\n // Priority for parameters\r\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\r\n api_key = params['apiKey'];\r\n log_id = params['logId'];\r\n }\r\n\r\n // get new XHR object\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\r\n xhr.setRequestHeader('Content-type', 'application/json');\r\n\r\n xhr.onload = function (e) {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 201) {\r\n callback('success', xhr.statusText);\r\n }\r\n }\r\n };\r\n\r\n xhr.onerror = function (e) {\r\n callback('error', xhr.statusText);\r\n\r\n // on error event\r\n publicAPIs.emit('error', xhr.status, xhr.statusText);\r\n }\r\n\r\n var stack = ErrorStackParser(settings).parse(error.error);\r\n\r\n var jsonData = {\r\n \"detail\": error.error.stack,\r\n \"title\": error.message || 'Unspecified error',\r\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\r\n \"severity\": \"Error\",\r\n \"type\": error.error.name,\r\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\r\n };\r\n\r\n // Add payload to jsonData\r\n jsonData = merge_objects(jsonData, getPayload());\r\n\r\n // filter callback\r\n if (settings.filter !== null) {\r\n if (settings.filter(jsonData)) {\r\n send = 0;\r\n }\r\n }\r\n\r\n if (send === 1) {\r\n // on message event\r\n publicAPIs.emit('message', jsonData);\r\n\r\n // send message\r\n xhr.send(JSON.stringify(jsonData));\r\n }\r\n\r\n } else {\r\n return console.log('Login api error');\r\n }\r\n };\r\n\r\n var sendManualPayload = function (apiKey, logId, callback, logType, messageLog, errorLog) {\r\n var api_key = apiKey,\r\n log_id = logId,\r\n type = logType,\r\n error = errorLog,\r\n message = messageLog,\r\n send = 1,\r\n queryParams = getSearchParameters();\r\n\r\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\r\n\r\n // Priority for parameters\r\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\r\n api_key = params['apiKey'];\r\n log_id = params['logId'];\r\n }\r\n\r\n // get new XHR object\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\r\n xhr.setRequestHeader('Content-type', 'application/json');\r\n\r\n xhr.onload = function (e) {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 201) {\r\n callback('success', xhr.statusText);\r\n }\r\n }\r\n };\r\n\r\n xhr.onerror = function (e) {\r\n callback('error', xhr.statusText);\r\n\r\n // on error event\r\n publicAPIs.emit('error', xhr.status, xhr.statusText);\r\n }\r\n\r\n if (type !== \"Log\") {\r\n\r\n var stack = error ? ErrorStackParser(settings).parse(error) : null;\r\n\r\n var jsonData = {\r\n \"title\": message,\r\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\r\n \"detail\": error ? error.stack : null,\r\n \"severity\": type,\r\n \"type\": error ? error.name : null,\r\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\r\n };\r\n\r\n // Add payload to jsonData\r\n jsonData = merge_objects(jsonData, getPayload());\r\n\r\n } else {\r\n\r\n jsonData = error;\r\n\r\n }\r\n\r\n // filter callback\r\n if (settings.filter !== null) {\r\n if (settings.filter(jsonData)) {\r\n send = 0;\r\n }\r\n }\r\n\r\n if (send === 1) {\r\n if (jsonData.title) {\r\n\r\n // on message event\r\n publicAPIs.emit('message', jsonData);\r\n\r\n // send message\r\n xhr.send(JSON.stringify(jsonData));\r\n\r\n } else {\r\n callback('missing-title', xhr.statusText);\r\n }\r\n }\r\n\r\n } else {\r\n return console.log('Login api error');\r\n }\r\n };\r\n\r\n // Some public methods\r\n\r\n publicAPIs.error = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg);\r\n };\r\n publicAPIs.error = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg, error);\r\n };\r\n\r\n publicAPIs.verbose = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg);\r\n };\r\n publicAPIs.verbose = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg, error);\r\n };\r\n\r\n publicAPIs.debug = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg);\r\n };\r\n publicAPIs.debug = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg, error);\r\n };\r\n\r\n publicAPIs.information = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg);\r\n };\r\n publicAPIs.information = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg, error);\r\n };\r\n\r\n publicAPIs.warning = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg);\r\n };\r\n publicAPIs.warning = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg, error);\r\n };\r\n\r\n publicAPIs.fatal = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg);\r\n };\r\n publicAPIs.fatal = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg, error);\r\n };\r\n\r\n publicAPIs.log = function (obj) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj);\r\n };\r\n\r\n publicAPIs.on = function (name, callback, ctx) {\r\n var e = this.e || (this.e = {});\r\n\r\n (e[name] || (e[name] = [])).push({\r\n fn: callback,\r\n ctx: ctx\r\n });\r\n\r\n return this;\r\n };\r\n\r\n publicAPIs.emit = function (name) {\r\n var data = [].slice.call(arguments, 1);\r\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\r\n var i = 0;\r\n var len = evtArr.length;\r\n\r\n for (i; i < len; i++) {\r\n evtArr[i].fn.apply(evtArr[i].ctx, data);\r\n }\r\n\r\n return this;\r\n };\r\n\r\n publicAPIs.init = function (options) {\r\n\r\n // Merge options into defaults\r\n settings = extend(defaults, options || {});\r\n\r\n // Code goes here...\r\n window.onerror = function (message, source, lineno, colno, error) {\r\n\r\n var errorLog = {\r\n 'message': message,\r\n 'source': source,\r\n 'lineno': lineno,\r\n 'colno': colno,\r\n 'error': error\r\n }\r\n\r\n sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog);\r\n\r\n return false;\r\n }\r\n\r\n };\r\n\r\n // Initialize the plugin\r\n publicAPIs.init(options);\r\n\r\n if (settings.debug) {\r\n console.log('%c' + debugSettings.label, debugSettings.labelCSS);\r\n }\r\n\r\n // Return the public APIs\r\n return publicAPIs;\r\n\r\n };\r\n\r\n\r\n //\r\n // Return the constructor\r\n //\r\n\r\n if (paramsLength && params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\r\n // Immediately-Invoked Function Expression (IIFE)\r\n return new Constructor;\r\n } else {\r\n // UMD Constructor\r\n return Constructor;\r\n }\r\n\r\n});\r\n"],"file":"elmahio.js"} \ No newline at end of file diff --git a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js index 0448d88..d102674 100644 --- a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js +++ b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js @@ -1,6 +1,6 @@ /*! - * elmah.io Javascript Logger - version 3.0.0-beta1 + * elmah.io Javascript Logger - version 3.0.0-beta2 * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io */ -!function(e,n){"function"==typeof define&&define.amd?define([],function(){return n(e)}):"object"==typeof exports?module.exports=n(e):e.Elmahio=n(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,function(e){"use strict";var n=document.getElementsByTagName("script"),t=function(e){var n=new Object;if(!e)return n;for(var t=e.split(/[;&]/),r=0;r-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),t=this.extractLocation(n.pop());return{functionName:n.join(" ")||void 0,fileName:["eval",""].indexOf(t[0])>-1?void 0:t[0],lineNumber:t[1],columnNumber:t[2],source:e}},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(r)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return{functionName:e};var n=/((.*".+"[^@]*)?[^@]*)(?:@)/,t=e.match(n),r=t&&t[1]?t[1]:void 0,o=this.extractLocation(e.replace(n,""));return{functionName:r,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,t=e.message.split("\n"),r=[],o=2,a=t.length;o/,"$2").replace(/\([^\)]*\)/g,"")||void 0;return o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1")),{functionName:a,args:void 0===n||"[arguments not available]"===n?void 0:n.split(","),fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e}},this)}}}var u=function(n){var u,p={};function d(){var n={url:[document.location.protocol,"//",document.location.host,document.location.pathname,document.location.hash].join("")||"/",application:u.application},t=[];navigator.language&&t.push({key:"User-Language",value:navigator.language}),document.documentMode&&t.push({key:"Document-Mode",value:document.documentMode}),(e.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth)&&t.push({key:"Browser-Width",value:e.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth}),(e.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight)&&t.push({key:"Browser-Height",value:e.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight}),null!=(screen.msOrientation||(screen.orientation||screen.mozOrientation||{}).type)&&t.push({key:"Screen-Orientation",value:(screen.msOrientation||(screen.orientation||screen.mozOrientation||{}).type).split("-")[0]}),screen.width&&t.push({key:"Screen-Width",value:screen.width}),screen.height&&t.push({key:"Screen-Height",value:screen.height}),screen.colorDepth&&t.push({key:"Color-Depth",value:screen.colorDepth}),t.push({key:"X-ELMAHIO-SEARCH-isClientside",value:"true"}),n.data=t;var r=[];return navigator.userAgent&&r.push({key:"User-Agent",value:navigator.userAgent}),document.referrer&&r.push({key:"Referer",value:document.referrer}),n.serverVariables=r,n}function g(e,n){u.debug&&("error"===e?console.log("%c ⯈ Error log: %c ✕ Not created ",o.lightCSS,o.errorCSS):console.log("%c ⯈ Error log: %c ✔ "+n+" at "+(new Date).toLocaleString()+" ",o.lightCSS,o.successCSS))}var f=function(e,n,o,a,i,p){var g=e,f=n,m=a,h=p,v=i,y=1,b=l();if((null===g||null===f)&&2!==r)return console.log("Login api error");t.hasOwnProperty("apiKey")&&t.hasOwnProperty("logId")&&(g=t.apiKey,f=t.logId);var S=new XMLHttpRequest;if(S.open("POST","https://api.elmah.io/v3/messages/"+f+"?api_key="+g,!0),S.setRequestHeader("Content-type","application/json"),S.onload=function(e){4===S.readyState&&201===S.status&&o("success",S.statusText)},S.onerror=function(e){o("error",S.statusText),null!==u.onError&&u.onError(S.status,S.statusText)},"Log"!==m){var O=h?c(u).parse(h):null,k={title:v,source:O&&O.length>0?O[0].fileName:null,detail:h?h.stack:null,severity:m,type:h?h.name:null,queryString:JSON.parse(JSON.stringify(b))};k=s(k,d())}else k=h;null!==u.onFilter&&u.onFilter(k)&&(y=0),null!==u.onMessage&&u.onMessage(k),1===y&&S.send(JSON.stringify(k))};return p.error=function(e){f(u.apiKey,u.logId,g,"Error",e)},p.error=function(e,n){f(u.apiKey,u.logId,g,"Error",e,n)},p.verbose=function(e){f(u.apiKey,u.logId,g,"Verbose",e)},p.verbose=function(e,n){f(u.apiKey,u.logId,g,"Verbose",e,n)},p.debug=function(e){f(u.apiKey,u.logId,g,"Debug",e)},p.debug=function(e,n){f(u.apiKey,u.logId,g,"Debug",e,n)},p.information=function(e){f(u.apiKey,u.logId,g,"Information",e)},p.information=function(e,n){f(u.apiKey,u.logId,g,"Information",e,n)},p.warning=function(e){f(u.apiKey,u.logId,g,"Warning",e)},p.warning=function(e,n){f(u.apiKey,u.logId,g,"Warning",e,n)},p.fatal=function(e){f(u.apiKey,u.logId,g,"Fatal",e)},p.fatal=function(e,n){f(u.apiKey,u.logId,g,"Fatal",e,n)},p.log=function(e){f(u.apiKey,u.logId,g,"Log",null,e)},p.init=function(n){u=i(a,n||{}),e.onerror=function(e,n,o,a,i){var p={message:e,source:n,lineno:o,colno:a,error:i};return function(e,n,o,a){var i=e,p=n,g=a,f=1,m=l();if((null===i||null===p)&&2!==r)return console.log("Login api error");t.hasOwnProperty("apiKey")&&t.hasOwnProperty("logId")&&(i=t.apiKey,p=t.logId);var h=new XMLHttpRequest;h.open("POST","https://api.elmah.io/v3/messages/"+p+"?api_key="+i,!0),h.setRequestHeader("Content-type","application/json"),h.onload=function(e){4===h.readyState&&201===h.status&&o("success",h.statusText)},h.onerror=function(e){o("error",h.statusText),null!==u.onError&&u.onError(h.status,h.statusText)};var v=c(u).parse(g.error),y={detail:g.error.stack,title:g.message,source:v&&v.length>0?v[0].fileName:null,severity:"Error",type:g.error.name,queryString:JSON.parse(JSON.stringify(m))};y=s(y,d()),null!==u.onFilter&&u.onFilter(y)&&(f=0),null!==u.onMessage&&u.onMessage(y),1===f&&h.send(JSON.stringify(y))}(u.apiKey,u.logId,g,p),!1}},p.init(n),u.debug&&console.log("%c"+o.label,o.labelCSS),p};return r&&t.hasOwnProperty("apiKey")&&t.hasOwnProperty("logId")?new u:u}); +!function(e,t){"function"==typeof define&&define.amd?define([],function(){return t(e)}):"object"==typeof exports?module.exports=t(e):e.Elmahio=t(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,function(e){"use strict";var t=document.getElementsByTagName("script"),n=function(e){var t=new Object;if(!e)return t;for(var n=e.split(/[;&]/),r=0;r-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(t.pop());return{functionName:t.join(" ")||void 0,fileName:["eval",""].indexOf(n[0])>-1?void 0:n[0],lineNumber:n[1],columnNumber:n[2],source:e}},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(r)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return{functionName:e};var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,o=this.extractLocation(e.replace(t,""));return{functionName:r,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],o=2,i=n.length;o/,"$2").replace(/\([^\)]*\)/g,"")||void 0;return o.match(/\(([^\)]*)\)/)&&(t=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1")),{functionName:i,args:void 0===t||"[arguments not available]"===t?void 0:t.split(","),fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e}},this)}}}var u=function(t){var u,p={};function d(){var t={url:document.location.pathname||"/",application:u.application},n=[];navigator.language&&n.push({key:"User-Language",value:navigator.language}),document.documentMode&&n.push({key:"Document-Mode",value:document.documentMode}),(e.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth)&&n.push({key:"Browser-Width",value:e.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth}),(e.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight)&&n.push({key:"Browser-Height",value:e.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight}),void 0!==(screen.msOrientation||(screen.orientation||screen.mozOrientation||{}).type)&&n.push({key:"Screen-Orientation",value:(screen.msOrientation||(screen.orientation||screen.mozOrientation||{}).type).split("-")[0]}),screen.width&&n.push({key:"Screen-Width",value:screen.width}),screen.height&&n.push({key:"Screen-Height",value:screen.height}),screen.colorDepth&&n.push({key:"Color-Depth",value:screen.colorDepth}),n.push({key:"X-ELMAHIO-SEARCH-isClientside",value:"true"}),t.data=n;var r=[];return navigator.userAgent&&r.push({key:"User-Agent",value:navigator.userAgent}),document.referrer&&r.push({key:"Referer",value:document.referrer}),"https:"===document.location.protocol&&r.push({key:"HTTPS",value:"on"}),document.location.hostname&&r.push({key:"Host",value:document.location.hostname}),t.serverVariables=r,t}function f(e,t){u.debug&&("error"===e?console.log("%c ⯈ Error log: %c ✕ Not created ",o.lightCSS,o.errorCSS):"success"===e?console.log("%c ⯈ Error log: %c ✔ "+t+" at "+(new Date).toLocaleString()+" ",o.lightCSS,o.successCSS):console.log("%c ⯈ Error log: %c ✕ Not created. Title should not be undefined, null or empty ! ",o.lightCSS,o.errorCSS))}var g=function(e,t,o,i,a,f){var g=e,m=t,h=i,v=f,y=a,b=1,S=l();if((null===g||null===m)&&2!==r)return console.log("Login api error");n.hasOwnProperty("apiKey")&&n.hasOwnProperty("logId")&&(g=n.apiKey,m=n.logId);var O=new XMLHttpRequest;if(O.open("POST","https://api.elmah.io/v3/messages/"+m+"?api_key="+g,!0),O.setRequestHeader("Content-type","application/json"),O.onload=function(e){4===O.readyState&&201===O.status&&o("success",O.statusText)},O.onerror=function(e){o("error",O.statusText),p.emit("error",O.status,O.statusText)},"Log"!==h){var k=v?c(u).parse(v):null,N={title:y,source:k&&k.length>0?k[0].fileName:null,detail:v?v.stack:null,severity:h,type:v?v.name:null,queryString:JSON.parse(JSON.stringify(S))};N=s(N,d())}else N=v;null!==u.filter&&u.filter(N)&&(b=0),1===b&&(N.title?(p.emit("message",N),O.send(JSON.stringify(N))):o("missing-title",O.statusText))};return p.error=function(e){g(u.apiKey,u.logId,f,"Error",e)},p.error=function(e,t){g(u.apiKey,u.logId,f,"Error",e,t)},p.verbose=function(e){g(u.apiKey,u.logId,f,"Verbose",e)},p.verbose=function(e,t){g(u.apiKey,u.logId,f,"Verbose",e,t)},p.debug=function(e){g(u.apiKey,u.logId,f,"Debug",e)},p.debug=function(e,t){g(u.apiKey,u.logId,f,"Debug",e,t)},p.information=function(e){g(u.apiKey,u.logId,f,"Information",e)},p.information=function(e,t){g(u.apiKey,u.logId,f,"Information",e,t)},p.warning=function(e){g(u.apiKey,u.logId,f,"Warning",e)},p.warning=function(e,t){g(u.apiKey,u.logId,f,"Warning",e,t)},p.fatal=function(e){g(u.apiKey,u.logId,f,"Fatal",e)},p.fatal=function(e,t){g(u.apiKey,u.logId,f,"Fatal",e,t)},p.log=function(e){g(u.apiKey,u.logId,f,"Log",null,e)},p.on=function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},p.emit=function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r0?y[0].fileName:null,severity:"Error",type:g.error.name,queryString:JSON.parse(JSON.stringify(h))};b=s(b,d()),null!==u.filter&&u.filter(b)&&(m=0),1===m&&(p.emit("message",b),v.send(JSON.stringify(b)))}(u.apiKey,u.logId,f,g),!1}},p.init(t),u.debug&&console.log("%c"+o.label,o.labelCSS),p};return r&&n.hasOwnProperty("apiKey")&&n.hasOwnProperty("logId")?new u:u}); //# sourceMappingURL=elmahio.min.js.map diff --git a/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js.map b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js.map new file mode 100644 index 0000000..0b03b7d --- /dev/null +++ b/samples/Elmah.Io.Js.Mvc/Elmah.Io.Js.Mvc/Scripts/elmahio.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["elmahio.js"],"names":["root","factory","define","amd","exports","module","Elmahio","global","window","this","scriptFile","document","getElementsByTagName","params","query","Params","Object","Pairs","split","i","length","KeyVal","key","unescape","val","replace","parseQuery","src","paramsLength","obj","size","hasOwnProperty","objectLength","debugSettings","label","labelCSS","successCSS","errorCSS","warningCSS","lightCSS","defaults","apiKey","logId","debug","application","filter","extend","extended","deep","prototype","toString","call","arguments","merge","prop","getSearchParameters","prmstr","location","search","substr","prmarr","tmparr","push","value","transformToAssocArray","merge_objects","obj1","obj2","obj3","attrname1","attrname2","ErrorStackParser","settings","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","parse","error","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","console","log","extractLocation","urlLike","indexOf","parts","exec","undefined","line","map","tokens","slice","locationParts","pop","functionName","join","fileName","lineNumber","columnNumber","source","functionNameRegex","matches","e","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","argsRaw","functionCall","shift","args","Constructor","options","publicAPIs","getPayload","payload","url","pathname","payload_data","navigator","language","documentMode","innerWidth","documentElement","clientWidth","innerHeight","clientHeight","screen","msOrientation","orientation","mozOrientation","type","width","height","colorDepth","data","payload_serverVariables","userAgent","referrer","protocol","hostname","serverVariables","confirmResponse","status","response","Date","toLocaleString","sendManualPayload","callback","logType","messageLog","errorLog","api_key","log_id","send","queryParams","xhr","XMLHttpRequest","open","setRequestHeader","onload","readyState","statusText","onerror","emit","jsonData","title","detail","severity","name","queryString","JSON","stringify","msg","verbose","information","warning","fatal","on","ctx","fn","evt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AASjE,GACrBkD,EAAS,QAASQ,EAAIM,YACtBjD,EAAWmD,KAAK,QAASR,EAAIb,OAAQa,EAAIM,aAE3C,IAAI1F,EAAQT,EAAiBC,GAAUI,MAAMC,EAAMA,OAC/CgG,EAAW,CACbE,OAAUlG,EAAMA,MAAMG,MACtB8F,MAASjG,EAAM8B,SAAW,oBAC1BJ,OAAUvB,GAASA,EAAM5D,OAAS,EAAI4D,EAAM,GAAGoB,SAAW,KAC1D4E,SAAY,QACZrC,KAAQ9D,EAAMA,MAAMoG,KACpBC,YAAeC,KAAKvG,MAAMuG,KAAKC,UAAUjB,KAE3CU,EAAW5G,EAAc4G,EAAUnD,KACX,OAApBlD,EAAS3B,QACP2B,EAAS3B,OAAOgI,KAClBX,EAAO,GAGE,IAATA,IACFzC,EAAWmD,KAAK,UAAWC,GAC3BT,EAAIF,KAAKiB,KAAKC,UAAUP,KAmI1BqB,CAAY1H,EAAS/B,OAAQ+B,EAAS9B,MAAO4G,EAAiBS,IACvD,IAGXtC,EAAWsE,KAAKvE,GACZhD,EAAS7B,OACXyC,QAAQC,IAAI,KAAOpD,EAAcC,MAAOD,EAAcE,UAEjDsF,GAET,OAAI7F,GAAgBf,EAAOkB,eAAe,WAAalB,EAAOkB,eAAe,SACpE,IAAIwF,EAEJA","sourcesContent":["/*!\r\n * elmah.io Javascript Logger - version 3.0.0-beta2\r\n * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io\r\n */\r\n(function (root, factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n define([], function () {\r\n return factory(root);\r\n });\r\n } else if (typeof exports === 'object') {\r\n module.exports = factory(root);\r\n } else {\r\n root.Elmahio = factory(root);\r\n }\r\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) {\r\n\r\n 'use strict';\r\n\r\n //\r\n // Shared Variables\r\n //\r\n\r\n var scriptFile = document.getElementsByTagName('script');\r\n var scriptIndex = scriptFile.length - 1;\r\n var myScript = scriptFile[scriptIndex];\r\n var queryString = myScript.src.replace(/^[^\\?]+\\??/, '');\r\n var params = parseQuery(queryString);\r\n var paramsLength = objectLength(params);\r\n\r\n var debugSettings = {\r\n label: ' elmah.io debugger : On ',\r\n labelCSS: 'background: #06a89c; color: #ffffff; display: inline-block; font-size: 14px;',\r\n successCSS: 'background: #d4edda; color: #155724; display: inline-block; font-size: 13px;',\r\n errorCSS: 'background: #f8d7da; color: #721c24; display: inline-block; font-size: 13px;',\r\n warningCSS: 'background: #fff3cd; color: #856404; display: inline-block; font-size: 13px;',\r\n lightCSS: 'background: #e2e3e5; color: #383d41; display: inline-block; font-size: 13px;'\r\n };\r\n\r\n var defaults = {\r\n apiKey: null,\r\n logId: null,\r\n debug: false,\r\n application: null,\r\n filter: null\r\n };\r\n\r\n //\r\n // Shared Methods\r\n //\r\n\r\n var extend = function () {\r\n\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n\r\n // Check if a deep merge\r\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\r\n deep = arguments[0];\r\n i++;\r\n }\r\n\r\n // Merge the object into the extended object\r\n var merge = function (obj) {\r\n for (var prop in obj) {\r\n if (obj.hasOwnProperty(prop)) {\r\n // If property is an object, merge properties\r\n if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\r\n extended[prop] = extend(extended[prop], obj[prop]);\r\n } else {\r\n extended[prop] = obj[prop];\r\n }\r\n }\r\n }\r\n };\r\n\r\n // Loop through each object and conduct a merge\r\n for (; i < arguments.length; i++) {\r\n var obj = arguments[i];\r\n merge(obj);\r\n }\r\n\r\n return extended;\r\n\r\n };\r\n\r\n //\r\n // Helpers\r\n //\r\n\r\n function parseQuery(query) {\r\n var Params = new Object();\r\n if (!query) return Params; // return empty object\r\n var Pairs = query.split(/[;&]/);\r\n for (var i = 0; i < Pairs.length; i++) {\r\n var KeyVal = Pairs[i].split('=');\r\n if (!KeyVal || KeyVal.length !== 2) continue;\r\n var key = unescape(KeyVal[0]);\r\n var val = unescape(KeyVal[1]);\r\n val = val.replace(/\\+/g, ' ');\r\n Params[key] = val;\r\n }\r\n return Params;\r\n }\r\n\r\n function objectLength(obj) {\r\n var size = 0, key;\r\n for (key in obj) {\r\n if (obj.hasOwnProperty(key)) size++;\r\n }\r\n return size;\r\n };\r\n\r\n function getSearchParameters() {\r\n var prmstr = window.location.search.substr(1);\r\n return prmstr !== null && prmstr !== \"\" ? transformToAssocArray(prmstr) : {};\r\n }\r\n\r\n function transformToAssocArray(prmstr) {\r\n var params = [];\r\n var prmarr = prmstr.split(\"&\");\r\n for (var i = 0; i < prmarr.length; i++) {\r\n var tmparr = prmarr[i].split(\"=\");\r\n params.push({\r\n 'key': tmparr[0],\r\n 'value': tmparr[1]\r\n });\r\n }\r\n return params;\r\n }\r\n\r\n function merge_objects(obj1, obj2) {\r\n var obj3 = {};\r\n for (var attrname1 in obj1) {\r\n obj3[attrname1] = obj1[attrname1];\r\n }\r\n for (var attrname2 in obj2) {\r\n obj3[attrname2] = obj2[attrname2];\r\n }\r\n\r\n return obj3;\r\n }\r\n\r\n function ErrorStackParser(settings) {\r\n 'use strict';\r\n\r\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+\\:\\d+/;\r\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+\\:\\d+|\\(native\\))/m;\r\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code\\])?$/;\r\n\r\n return {\r\n parse: function (error) {\r\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\r\n return this.parseOpera(error);\r\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\r\n return this.parseV8OrIE(error);\r\n } else if (error.stack) {\r\n return this.parseFFOrSafari(error);\r\n } else if (settings.debug) {\r\n console.log('%c Cannot parse given Error object', debugSettings.warningCSS);\r\n } else {\r\n return null;\r\n }\r\n },\r\n\r\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\r\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\r\n // Fail-fast but return locations like \"(native)\"\r\n if (urlLike.indexOf(':') === -1) {\r\n return [urlLike];\r\n }\r\n\r\n var regExp = /(.+?)(?:\\:(\\d+))?(?:\\:(\\d+))?$/;\r\n var parts = regExp.exec(urlLike.replace(/[\\(\\)]/g, ''));\r\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\r\n },\r\n\r\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\r\n var filtered = error.stack.split('\\n').filter(function (line) {\r\n return !!line.match(CHROME_IE_STACK_REGEXP);\r\n }, this);\r\n\r\n return filtered.map(function (line) {\r\n if (line.indexOf('(eval ') > -1) {\r\n // Throw away eval information until we implement stacktrace.js/stackframe#8\r\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^\\()]*)|(\\)\\,.*$)/g, '');\r\n }\r\n var tokens = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').split(/\\s+/).slice(1);\r\n var locationParts = this.extractLocation(tokens.pop());\r\n var functionName = tokens.join(' ') || undefined;\r\n var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\r\n\r\n return ({\r\n functionName: functionName,\r\n fileName: fileName,\r\n lineNumber: locationParts[1],\r\n columnNumber: locationParts[2],\r\n source: line\r\n });\r\n }, this);\r\n },\r\n\r\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\r\n var filtered = error.stack.split('\\n').filter(function (line) {\r\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\r\n }, this);\r\n\r\n return filtered.map(function (line) {\r\n // Throw away eval information until we implement stacktrace.js/stackframe#8\r\n if (line.indexOf(' > eval') > -1) {\r\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval\\:\\d+\\:\\d+/g, ':$1');\r\n }\r\n\r\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\r\n // Safari eval frames only have function names and nothing else\r\n return ({\r\n functionName: line\r\n });\r\n } else {\r\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\r\n var matches = line.match(functionNameRegex);\r\n var functionName = matches && matches[1] ? matches[1] : undefined;\r\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\r\n\r\n return ({\r\n functionName: functionName,\r\n fileName: locationParts[0],\r\n lineNumber: locationParts[1],\r\n columnNumber: locationParts[2],\r\n source: line\r\n });\r\n }\r\n }, this);\r\n },\r\n\r\n parseOpera: function ErrorStackParser$$parseOpera(e) {\r\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\r\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\r\n return this.parseOpera9(e);\r\n } else if (!e.stack) {\r\n return this.parseOpera10(e);\r\n } else {\r\n return this.parseOpera11(e);\r\n }\r\n },\r\n\r\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\r\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\r\n var lines = e.message.split('\\n');\r\n var result = [];\r\n\r\n for (var i = 2, len = lines.length; i < len; i += 2) {\r\n var match = lineRE.exec(lines[i]);\r\n if (match) {\r\n result.push(({\r\n fileName: match[2],\r\n lineNumber: match[1],\r\n source: lines[i]\r\n }));\r\n }\r\n }\r\n\r\n return result;\r\n },\r\n\r\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\r\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\r\n var lines = e.stacktrace.split('\\n');\r\n var result = [];\r\n\r\n for (var i = 0, len = lines.length; i < len; i += 2) {\r\n var match = lineRE.exec(lines[i]);\r\n if (match) {\r\n result.push(\r\n ({\r\n functionName: match[3] || undefined,\r\n fileName: match[2],\r\n lineNumber: match[1],\r\n source: lines[i]\r\n })\r\n );\r\n }\r\n }\r\n\r\n return result;\r\n },\r\n\r\n // Opera 10.65+ Error.stack very similar to FF/Safari\r\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\r\n var filtered = error.stack.split('\\n').filter(function (line) {\r\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\r\n }, this);\r\n\r\n return filtered.map(function (line) {\r\n var tokens = line.split('@');\r\n var locationParts = this.extractLocation(tokens.pop());\r\n var functionCall = (tokens.shift() || '');\r\n var functionName = functionCall\r\n .replace(//, '$2')\r\n .replace(/\\([^\\)]*\\)/g, '') || undefined;\r\n var argsRaw;\r\n if (functionCall.match(/\\(([^\\)]*)\\)/)) {\r\n argsRaw = functionCall.replace(/^[^\\(]+\\(([^\\)]*)\\)$/, '$1');\r\n }\r\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\r\n undefined : argsRaw.split(',');\r\n\r\n return ({\r\n functionName: functionName,\r\n args: args,\r\n fileName: locationParts[0],\r\n lineNumber: locationParts[1],\r\n columnNumber: locationParts[2],\r\n source: line\r\n });\r\n }, this);\r\n }\r\n };\r\n\r\n }\r\n\r\n\r\n //\r\n // Constructor\r\n // Can be named anything you want\r\n //\r\n\r\n var Constructor = function (options) {\r\n\r\n //\r\n // Unique Variables\r\n //\r\n\r\n var publicAPIs = {};\r\n var settings;\r\n\r\n function getPayload() {\r\n var payload = {\r\n \"url\": document.location.pathname || '/',\r\n \"application\": settings.application\r\n };\r\n\r\n var payload_data = [];\r\n\r\n if (navigator.language) payload_data.push({ \"key\": \"User-Language\", \"value\": navigator.language });\r\n if (document.documentMode) payload_data.push({ \"key\": \"Document-Mode\", \"value\": document.documentMode });\r\n if (window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth) payload_data.push({ \"key\": \"Browser-Width\", \"value\": window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth });\r\n if (window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight) payload_data.push({ \"key\": \"Browser-Height\", \"value\": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight });\r\n if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ \"key\": \"Screen-Orientation\", \"value\": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split(\"-\"))[0] });\r\n if (screen.width) payload_data.push({ \"key\": \"Screen-Width\", \"value\": screen.width });\r\n if (screen.height) payload_data.push({ \"key\": \"Screen-Height\", \"value\": screen.height });\r\n if (screen.colorDepth) payload_data.push({ \"key\": \"Color-Depth\", \"value\": screen.colorDepth });\r\n payload_data.push({ \"key\": \"X-ELMAHIO-SEARCH-isClientside\", \"value\": \"true\" });\r\n\r\n payload.data = payload_data;\r\n\r\n var payload_serverVariables = [];\r\n if (navigator.userAgent) payload_serverVariables.push({ \"key\": \"User-Agent\", \"value\": navigator.userAgent });\r\n if (document.referrer) payload_serverVariables.push({ \"key\": \"Referer\", \"value\": document.referrer });\r\n if (document.location.protocol === \"https:\") payload_serverVariables.push({ \"key\": \"HTTPS\", \"value\": 'on' });\r\n if (document.location.hostname) payload_serverVariables.push({ \"key\": \"Host\", \"value\": document.location.hostname });\r\n\r\n payload.serverVariables = payload_serverVariables;\r\n\r\n return payload;\r\n }\r\n\r\n function confirmResponse(status, response) {\r\n if (settings.debug) {\r\n if (status === 'error') {\r\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS);\r\n } else if (status === 'success') {\r\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS);\r\n } else {\r\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS);\r\n }\r\n }\r\n }\r\n\r\n // Private methods\r\n\r\n var sendPayload = function (apiKey, logId, callback, errorLog) {\r\n var api_key = apiKey,\r\n log_id = logId,\r\n error = errorLog,\r\n send = 1,\r\n queryParams = getSearchParameters();\r\n\r\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\r\n\r\n // Priority for parameters\r\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\r\n api_key = params['apiKey'];\r\n log_id = params['logId'];\r\n }\r\n\r\n // get new XHR object\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\r\n xhr.setRequestHeader('Content-type', 'application/json');\r\n\r\n xhr.onload = function (e) {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 201) {\r\n callback('success', xhr.statusText);\r\n }\r\n }\r\n };\r\n\r\n xhr.onerror = function (e) {\r\n callback('error', xhr.statusText);\r\n\r\n // on error event\r\n publicAPIs.emit('error', xhr.status, xhr.statusText);\r\n }\r\n\r\n var stack = ErrorStackParser(settings).parse(error.error);\r\n\r\n var jsonData = {\r\n \"detail\": error.error.stack,\r\n \"title\": error.message || 'Unspecified error',\r\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\r\n \"severity\": \"Error\",\r\n \"type\": error.error.name,\r\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\r\n };\r\n\r\n // Add payload to jsonData\r\n jsonData = merge_objects(jsonData, getPayload());\r\n\r\n // filter callback\r\n if (settings.filter !== null) {\r\n if (settings.filter(jsonData)) {\r\n send = 0;\r\n }\r\n }\r\n\r\n if (send === 1) {\r\n // on message event\r\n publicAPIs.emit('message', jsonData);\r\n\r\n // send message\r\n xhr.send(JSON.stringify(jsonData));\r\n }\r\n\r\n } else {\r\n return console.log('Login api error');\r\n }\r\n };\r\n\r\n var sendManualPayload = function (apiKey, logId, callback, logType, messageLog, errorLog) {\r\n var api_key = apiKey,\r\n log_id = logId,\r\n type = logType,\r\n error = errorLog,\r\n message = messageLog,\r\n send = 1,\r\n queryParams = getSearchParameters();\r\n\r\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\r\n\r\n // Priority for parameters\r\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\r\n api_key = params['apiKey'];\r\n log_id = params['logId'];\r\n }\r\n\r\n // get new XHR object\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\r\n xhr.setRequestHeader('Content-type', 'application/json');\r\n\r\n xhr.onload = function (e) {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 201) {\r\n callback('success', xhr.statusText);\r\n }\r\n }\r\n };\r\n\r\n xhr.onerror = function (e) {\r\n callback('error', xhr.statusText);\r\n\r\n // on error event\r\n publicAPIs.emit('error', xhr.status, xhr.statusText);\r\n }\r\n\r\n if (type !== \"Log\") {\r\n\r\n var stack = error ? ErrorStackParser(settings).parse(error) : null;\r\n\r\n var jsonData = {\r\n \"title\": message,\r\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\r\n \"detail\": error ? error.stack : null,\r\n \"severity\": type,\r\n \"type\": error ? error.name : null,\r\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\r\n };\r\n\r\n // Add payload to jsonData\r\n jsonData = merge_objects(jsonData, getPayload());\r\n\r\n } else {\r\n\r\n jsonData = error;\r\n\r\n }\r\n\r\n // filter callback\r\n if (settings.filter !== null) {\r\n if (settings.filter(jsonData)) {\r\n send = 0;\r\n }\r\n }\r\n\r\n if (send === 1) {\r\n if (jsonData.title) {\r\n\r\n // on message event\r\n publicAPIs.emit('message', jsonData);\r\n\r\n // send message\r\n xhr.send(JSON.stringify(jsonData));\r\n\r\n } else {\r\n callback('missing-title', xhr.statusText);\r\n }\r\n }\r\n\r\n } else {\r\n return console.log('Login api error');\r\n }\r\n };\r\n\r\n // Some public methods\r\n\r\n publicAPIs.error = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg);\r\n };\r\n publicAPIs.error = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg, error);\r\n };\r\n\r\n publicAPIs.verbose = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg);\r\n };\r\n publicAPIs.verbose = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg, error);\r\n };\r\n\r\n publicAPIs.debug = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg);\r\n };\r\n publicAPIs.debug = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg, error);\r\n };\r\n\r\n publicAPIs.information = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg);\r\n };\r\n publicAPIs.information = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg, error);\r\n };\r\n\r\n publicAPIs.warning = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg);\r\n };\r\n publicAPIs.warning = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg, error);\r\n };\r\n\r\n publicAPIs.fatal = function (msg) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg);\r\n };\r\n publicAPIs.fatal = function (msg, error) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg, error);\r\n };\r\n\r\n publicAPIs.log = function (obj) {\r\n sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj);\r\n };\r\n\r\n publicAPIs.on = function (name, callback, ctx) {\r\n var e = this.e || (this.e = {});\r\n\r\n (e[name] || (e[name] = [])).push({\r\n fn: callback,\r\n ctx: ctx\r\n });\r\n\r\n return this;\r\n };\r\n\r\n publicAPIs.emit = function (name) {\r\n var data = [].slice.call(arguments, 1);\r\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\r\n var i = 0;\r\n var len = evtArr.length;\r\n\r\n for (i; i < len; i++) {\r\n evtArr[i].fn.apply(evtArr[i].ctx, data);\r\n }\r\n\r\n return this;\r\n };\r\n\r\n publicAPIs.init = function (options) {\r\n\r\n // Merge options into defaults\r\n settings = extend(defaults, options || {});\r\n\r\n // Code goes here...\r\n window.onerror = function (message, source, lineno, colno, error) {\r\n\r\n var errorLog = {\r\n 'message': message,\r\n 'source': source,\r\n 'lineno': lineno,\r\n 'colno': colno,\r\n 'error': error\r\n }\r\n\r\n sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog);\r\n\r\n return false;\r\n }\r\n\r\n };\r\n\r\n // Initialize the plugin\r\n publicAPIs.init(options);\r\n\r\n if (settings.debug) {\r\n console.log('%c' + debugSettings.label, debugSettings.labelCSS);\r\n }\r\n\r\n // Return the public APIs\r\n return publicAPIs;\r\n\r\n };\r\n\r\n\r\n //\r\n // Return the constructor\r\n //\r\n\r\n if (paramsLength && params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\r\n // Immediately-Invoked Function Expression (IIFE)\r\n return new Constructor;\r\n } else {\r\n // UMD Constructor\r\n return Constructor;\r\n }\r\n\r\n});\r\n"],"file":"elmahio.min.js"} \ No newline at end of file