advanced-logger
Version:
Advanced logger module extendable with plugins. Works in nodejs and browsers
2 lines • 25.8 kB
JavaScript
window.advancedLogger=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=8)}([function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function o(t){return"object"==typeof t&&null!==t}function i(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,s,a,u,f;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(i(r=this._events[t]))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),s=(f=r.slice()).length,u=0;u<s;u++)f[u].apply(this,a);return!0},r.prototype.addListener=function(t,e){var s;if(!n(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(s=i(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!n(e))throw TypeError("listener must be a function");var r=!1;function o(){this.removeListener(t,o),r||(r=!0,e.apply(this,arguments))}return o.listener=e,this.on(t,o),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(r=this._events[t]).length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,r){var n=r(1),o=r(12),i=r(15),s="Expected a function",a=Math.max,u=Math.min;t.exports=function(t,e,r){var f,l,c,h,p,d,y=0,v=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(s);function b(e){var r=f,n=l;return f=l=void 0,y=e,h=t.apply(n,r)}function _(t){var r=t-d;return void 0===d||r>=e||r<0||g&&t-y>=c}function E(){var t=o();if(_(t))return w(t);p=setTimeout(E,function(t){var r=e-(t-d);return g?u(r,c-(t-y)):r}(t))}function w(t){return p=void 0,m&&f?b(t):(f=l=void 0,h)}function O(){var t=o(),r=_(t);if(f=arguments,l=this,d=t,r){if(void 0===p)return function(t){return y=t,p=setTimeout(E,e),v?b(t):h}(d);if(g)return p=setTimeout(E,e),b(d)}return void 0===p&&(p=setTimeout(E,e)),h}return e=i(e)||0,n(r)&&(v=!!r.leading,c=(g="maxWait"in r)?a(i(r.maxWait)||0,e):c,m="trailing"in r?!!r.trailing:m),O.cancel=function(){void 0!==p&&clearTimeout(p),y=0,f=d=l=p=void 0},O.flush=function(){return void 0===p?h:w(o())},O}},function(t,e,r){var n=r(13),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e,r){var n=r(3).Symbol;t.exports=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.RAPID_FIRE_GROUPING=0]="RAPID_FIRE_GROUPING"}(e.TransformationEnum||(e.TransformationEnum={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={getLogIdByFields:function(t,e){return e.map(function(e){return e+"-"+t[e]}).join("-")},tryJSONStringify:function(t){try{return JSON.stringify(t)}catch(t){return""}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(23),o=r(24),i=r(6),s=function(){function t(t){this.serviceConfig=t.serviceConfig,this.defaultLogConfig=t.defaultLogConfig||{}}return t.prototype.sendAllLogs=function(t){var e=this;return this.preparePayload(t).then(function(t){var r=e.getHeaders();return e.serviceConfig.retryAttempts&&e.serviceConfig.retryAttempts>0?o.default.postRequest(e.serviceConfig,r,t).catch(function(){return o.default.delayedRetry(e.serviceConfig.retryAttempts,e.serviceConfig.retryInterval,o.default.postRequest.bind(e,e.serviceConfig,r,t))}):o.default.postRequest(e.serviceConfig,r,t)})},t.prototype.preparePayload=function(t){var e=this,r=t.map(function(t){var r=Object.assign({},e.defaultLogConfig,t);return i.default.tryJSONStringify(r)||n.default(r)});return Promise.resolve(r.join("\n"))},t.prototype.destroy=function(){this.serviceConfig=null,this.defaultLogConfig=null},t.prototype.getHeaders=function(){return{}},t}();e.default=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(9);e.AdvancedLogger=n.default;var o=r(5);e.TransformationEnum=o.TransformationEnum;var i=r(21),s=r(22),a=r(27),u=r(28),f=r(29),l=r(30),c=r(31),h={InstantStrategy:u.default,OnBundleSizeStrategy:f.default,OnRequestStrategy:c.default,OnIntervalStrategy:l.default};e.strategy=h;var p={SumologicService:a.default,LogglyService:s.default,ConsoleService:i.default};e.service=p},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(10),o=function(){function t(t){this.configuration=t,this.logStore=new n.default({transformations:t.transformations}),this.strategy=this.configuration.strategy,this.service=this.configuration.service,this.logStore.eventEmitter.on("add",this.onAdd.bind(this)),this.logStore.eventEmitter.on("clear",this.onClear.bind(this)),this.logStore.eventEmitter.on("error",this.onStoreError.bind(this)),this.strategy.eventEmitter.on("send",this.onSend.bind(this)),this.strategy.eventEmitter.on("error",this.onStrategyError.bind(this))}return t.prototype.log=function(t){this.logStore.add(t)},t.prototype.sendAllLogs=function(){this.strategy.sendAll()},t.prototype.destroy=function(){this.logStore.destroy(),this.logStore=null,this.strategy.destroy(),this.strategy=null,this.service.destroy(),this.service=null,this.configuration=null},t.prototype.onStoreError=function(t){console.error(t)},t.prototype.onAdd=function(t){this.strategy.onAdd(t)},t.prototype.onClear=function(t){this.strategy.onClear()},t.prototype.onStrategyError=function(t){console.error(t)},t.prototype.onSend=function(){if(this.logStore.size()>0){var t=this.logStore.getAll();this.logStore.clear(),this.service.sendAllLogs(t).catch(function(t){console.log(t)})}},t}();e.default=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=r(11),i=r(5),s=r(6),a=function(){function t(t){this.groupLeftIndex=-1,this.logs=[],this.eventEmitter=new n.EventEmitter,this.config=t,this.initTransformations()}return t.prototype.add=function(t){if(this.identityMap){var e=s.default.getLogIdByFields(t,this.groupableConfig.configuration.groupIdentityFields);this.identityMap.has(e)||this.logs.push(t),this.onAddToGroup(t)}else this.logs.push(t);this.eventEmitter.emit("add",{logCount:this.size()})},t.prototype.clear=function(){this.logs.length=0,this.eventEmitter.emit("clear",null)},t.prototype.getAll=function(){return this.throttledOnGroupFinalize&&this.throttledOnGroupFinalize.flush(),this.logs.slice()},t.prototype.size=function(){return this.logs.length},t.prototype.destroy=function(){this.throttledOnGroupFinalize&&this.throttledOnGroupFinalize.cancel(),this.logs.length=0,this.eventEmitter.removeAllListeners(),this.eventEmitter=null},t.prototype.initTransformations=function(){if(this.config&&this.config.transformations){var t=this.config.transformations.find(function(t){return t.type===i.TransformationEnum.RAPID_FIRE_GROUPING});t&&(this.groupableConfig=t,this.identityMap=new Map,this.throttledOnGroupFinalize=o(this.onGroupFinalize.bind(this),this.groupableConfig.configuration.interval,{trailing:!0,leading:!1}),this.eventEmitter.on("add",this.throttledOnGroupFinalize))}},t.prototype.onAddToGroup=function(t){var e=s.default.getLogIdByFields(t,this.groupableConfig.configuration.groupIdentityFields);if(this.identityMap.has(e)){var r=this.identityMap.get(e);this.identityMap.set(e,r+1)}else this.identityMap.set(e,1)},t.prototype.onGroupFinalize=function(){var t=this.logs.length;if(t>0)for(var e=this.groupableConfig.configuration,r=-1!==this.groupLeftIndex?this.groupLeftIndex:0;r<t;r++){var n=this.logs[r],o=s.default.getLogIdByFields(n,e.groupIdentityFields);n[e.groupFieldName]=this.identityMap.has(o)?this.identityMap.get(o):1}this.groupLeftIndex=t>0?t-1:-1,this.identityMap.clear()},t}();e.default=a},function(t,e,r){var n=r(2),o=r(1),i="Expected a function";t.exports=function(t,e,r){var s=!0,a=!0;if("function"!=typeof t)throw new TypeError(i);return o(r)&&(s="leading"in r?!!r.leading:s,a="trailing"in r?!!r.trailing:a),n(t,e,{leading:s,maxWait:e,trailing:a})}},function(t,e,r){var n=r(3);t.exports=function(){return n.Date.now()}},function(t,e,r){(function(e){var r="object"==typeof e&&e&&e.Object===Object&&e;t.exports=r}).call(this,r(14))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){var n=r(1),o=r(16),i=NaN,s=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,f=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(o(t))return i;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var r=u.test(t);return r||f.test(t)?l(t.slice(2),r?2:8):a.test(t)?i:+t}},function(t,e,r){var n=r(17),o=r(20),i="[object Symbol]";t.exports=function(t){return"symbol"==typeof t||o(t)&&n(t)==i}},function(t,e,r){var n=r(4),o=r(18),i=r(19),s="[object Null]",a="[object Undefined]",u=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?a:s:u&&u in Object(t)?o(t):i(t)}},function(t,e,r){var n=r(4),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.preparePayload=function(t){return Promise.resolve(t)},t.prototype.sendAllLogs=function(t){return console.log(t),Promise.resolve()},t.prototype.destroy=function(){},t}();e.default=n},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.getHeaders=function(){return{"Content-Type":"text/plain"}},e}(r(7).default);e.default=i},function(t,e){t.exports=n,n.default=n,n.stable=i,n.stableStringify=i;var r=[];function n(t,e,n){!function t(e,n,o,i){var s;if("object"==typeof e&&null!==e){for(s=0;s<o.length;s++)if(o[s]===e)return i[n]="[Circular]",void r.push([i,n,e]);if(o.push(e),Array.isArray(e))for(s=0;s<e.length;s++)t(e[s],s,o,e);else{var a=Object.keys(e);for(s=0;s<a.length;s++){var u=a[s];t(e[u],u,o,e)}}o.pop()}}(t,"",[],void 0);for(var o=JSON.stringify(t,e,n);0!==r.length;){var i=r.pop();i[0][i[1]]=i[2]}return o}function o(t,e){return t<e?-1:t>e?1:0}function i(t,e,n){for(var i=function t(e,n,i,s){var a;if("object"==typeof e&&null!==e){for(a=0;a<i.length;a++)if(i[a]===e)return s[n]="[Circular]",void r.push([s,n,e]);if("function"==typeof e.toJSON)return;if(i.push(e),Array.isArray(e))for(a=0;a<e.length;a++)t(e[a],a,i,e);else{var u={},f=Object.keys(e).sort(o);for(a=0;a<f.length;a++){var l=f[a];t(e[l],l,i,e),u[l]=e[l]}if(void 0===s)return u;r.push([s,n,e]),s[n]=u}i.pop()}}(t,"",[],void 0)||t,s=JSON.stringify(i,e,n);0!==r.length;){var a=r.pop();a[0][a[1]]=a[2]}return s}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(25),o={postRequest:function(t,e,r){return n(t.url,{method:t.method,body:r,headers:e})},delayedRetry:function(t,e,r){return void 0===e&&(e=0),new Promise(function(t,n){setTimeout(function(){return r().then(t).catch(n)},e)}).catch(function(n){return t>1?o.delayedRetry(t-1,e,r):Promise.reject(n)})}};e.default=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),r(26),t.exports=window.fetch},function(t,e,r){!function(t){"use strict";var e={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function o(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function i(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function a(t){this.map={},t instanceof a?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var e=new FileReader,r=f(e);return e.readAsArrayBuffer(t),r}function c(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var r;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&(r=t)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=c(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=c(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,e,r,n=u(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=f(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}a.prototype.append=function(t,e){t=o(t),e=i(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},a.prototype.delete=function(t){delete this.map[o(t)]},a.prototype.get=function(t){return t=o(t),this.has(t)?this.map[t]:null},a.prototype.has=function(t){return this.map.hasOwnProperty(o(t))},a.prototype.set=function(t,e){this.map[o(t)]=i(e)},a.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},a.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),s(t)},a.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),s(t)},a.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),s(t)},e.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function d(t,e){var r,n,o=(e=e||{}).body;if(t instanceof d){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new a(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new a(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),p.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function y(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new a(e.headers),this.url=e.url||"",this._initBody(t)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},h.call(d.prototype),h.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var g=[301,302,303,307,308];v.redirect=function(t,e){if(-1===g.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.DOMException=self.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function m(r,n){return new Promise(function(o,i){var s=new d(r,n);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function f(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new a,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;o(new v(n,r))},u.onerror=function(){i(new TypeError("Network request failed"))},u.ontimeout=function(){i(new TypeError("Network request failed"))},u.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&e.blob&&(u.responseType="blob"),s.headers.forEach(function(t,e){u.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",f),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",f)}),u.send(void 0===s._bodyInit?null:s._bodyInit)})}m.polyfill=!0,self.fetch||(self.fetch=m,self.Headers=a,self.Request=d,self.Response=v),t.Headers=a,t.Request=d,t.Response=v,t.fetch=m,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.getHeaders=function(){var t=this.serviceConfig;return{"Content-Type":"application/json","X-Sumo-Category":t.sourceCategory,"X-Sumo-Host":t.host,"X-Sumo-Name":t.sourceName}},e}(r(7).default);e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=function(){function t(){this.eventEmitter=new n.EventEmitter}return t.prototype.onAdd=function(t){this.eventEmitter.emit("send")},t.prototype.onClear=function(){},t.prototype.sendAll=function(t){},t.prototype.destroy=function(){this.eventEmitter.removeAllListeners(),this.eventEmitter=null},t}();e.default=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=function(){function t(t){this.MAX_BUNDLE_SIZE=100,this.eventEmitter=new n.EventEmitter,t.maxBundle&&(this.MAX_BUNDLE_SIZE=t.maxBundle)}return t.prototype.onAdd=function(t){t&&t.logCount>=this.MAX_BUNDLE_SIZE&&this.eventEmitter.emit("send")},t.prototype.onClear=function(){},t.prototype.sendAll=function(t){this.eventEmitter.emit("send")},t.prototype.destroy=function(){this.eventEmitter.removeAllListeners(),this.eventEmitter=null},t}();e.default=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=r(2),i=function(){function t(t){this.SEND_INTERVAL=15e3,this.eventEmitter=new n.EventEmitter,t.interval&&(this.SEND_INTERVAL=t.interval),this.debouncedSend=o(this.send.bind(this),this.SEND_INTERVAL)}return t.prototype.onAdd=function(t){t&&t.logCount>0&&this.debouncedSend()},t.prototype.onClear=function(){},t.prototype.sendAll=function(t){this.eventEmitter.emit("send")},t.prototype.destroy=function(){this.eventEmitter.removeAllListeners(),this.eventEmitter=null},t.prototype.send=function(){this.eventEmitter.emit("send")},t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),o=function(){function t(){this.eventEmitter=new n.EventEmitter}return t.prototype.onAdd=function(t){},t.prototype.onClear=function(){},t.prototype.sendAll=function(t){this.eventEmitter.emit("send")},t.prototype.destroy=function(){this.eventEmitter.removeAllListeners(),this.eventEmitter=null},t}();e.default=o}]);
//# sourceMappingURL=advanced-logger.browser.min.js.map