Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-logs - npm Package Compare versions

Comparing version 1.24.1 to 1.25.0

cjs/boot/buildEnv.d.ts

2

bundle/datadog-logs.js

@@ -1,1 +0,1 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"datadogLogs",(function(){return ut})),n.d(t,"makeLogsGlobal",(function(){return ct}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function i(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}var a,s,u,c=1e3,f=60*c,l=60*f;!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.VISIBILITY_CHANGE="visibilitychange",e.DOM_CONTENT_LOADED="DOMContentLoaded"}(a||(a={})),function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(s||(s={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(u||(u={}));var d,p=function(e){return Array.isArray(e)},h=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function v(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length-1;r>=0;r-=1){var o=t[r];if(void 0!==o){if(void 0===e)if(h(o))e={};else{if(!p(o)){e=o;break}e=[]}if(h(e)&&h(o))for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=v(o[i],e[i]));else{if(!p(e)||!p(o))break;e.length=Math.max(e.length,o.length);for(var a=0;a<o.length;a+=1)e[a]=v(o[a],e[a])}}}return e}function g(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return v.apply(void 0,i([e],t.filter((function(e){return null!==e}))))}function m(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7+"-1000-4000-8000-100000000000").replace(/[018]/g,m)}function y(){}function b(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];w(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&w(o=Object.getPrototypeOf(e))&&(a=[!0,o.toJSON],delete o.toJSON);try{i=JSON.stringify(e,void 0,n)}catch(e){i="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(o.toJSON=a[1])}return i}function w(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function E(){return void 0===d&&(d=performance.timing.navigationStart),d}function T(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}var x,O,S=c;function k(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires="+o.toUTCString(),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+i+";path=/;samesite="+a+s+u}function M(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}function _(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+m();return k(t,"test",c,e),"test"===M(t)}catch(e){return console.error(e),!1}}function R(e){return I(e,T(window.location)).href}function L(e,t){return C(e)===C(t)}function C(e){return T(I(e))}function I(e,t){if(function(){if(void 0!==O)return O;try{var e=new URL("http://test/path");return O="http://test/path"===e.href}catch(e){O=!1}return O}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var N={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*c,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function B(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===x){for(var e="dd_site_test_"+m(),t=window.location.hostname.split("."),n=t.pop();t.length&&!M(e);)n=t.pop()+"."+n,k(e,"test",c,{domain:n});x=n}return x}()),t}function A(e,t,n){var r="sdk_version:"+t.sdkVersion+(t.env?",env:"+t.env:"")+(t.service?",service:"+t.service:"")+(t.version?",version:"+t.version:""),o=e+"-http-intake.logs."+t.site,i=t.proxyHost?t.proxyHost:o,a=t.proxyHost?"ddhost="+o+"&":"",s=""+(t.applicationId?"_dd.application_id="+t.applicationId+"&":"")+a+"ddsource="+(n||"browser")+"&ddtags="+r;return"https://"+i+"/v1/input/"+t.clientToken+"?"+s}function D(e,t){return-1!==function(e){var t=I(e).pathname;return"/"===t[0]?t:"/"+t}(e).indexOf("/v1/input/")&&(L(e,t.logsEndpoint)||L(e,t.rumEndpoint)||L(e,t.traceEndpoint)||!!t.internalMonitoringEndpoint&&L(e,t.internalMonitoringEndpoint)||!!t.replica&&(L(e,t.replica.logsEndpoint)||L(e,t.replica.rumEndpoint)||L(e,t.replica.internalMonitoringEndpoint)))}var j="?",P=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function U(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var z=function(){var e,t,n,r,o,i,a=[];function s(e,t,n){var r;for(var o in a)if(U(a,o))try{a[o](e,t,n)}catch(e){r=e}if(r)throw r}function u(e,r,o,i,a){if(t)H.augmentStackTraceWithInitialElement(t,r,o,""+e),f();else if(a)s(H(a),!0,a);else{var u,c={url:r,column:i,line:o},l=e;if("[object String]"==={}.toString.call(e)){var d=l.match(P);d&&(u=d[1],l=d[2])}s({name:u,message:l,stack:[c]},!0)}return!!n&&n.apply(this,arguments)}function c(e){var t=e.reason||"Empty reason";s(H(t),!0,t)}function f(){var n=t,r=e;t=void 0,e=void 0,s(n,!1,r)}function l(n){if(t){if(e===n)return;f()}var r=H(n);throw t=r,e=n,setTimeout((function(){e===n&&f()}),r.incomplete?2e3:0),n}return l.subscribe=function(e){!function(){if(r)return;n=window.onerror,window.onerror=Z(u),r=!0}(),function(){if(i)return;o=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=Z(c),i=!0}(),a.push(e)},l.unsubscribe=function(e){for(var t=a.length-1;t>=0;t-=1)a[t]===e&&a.splice(t,1);0===a.length&&(r&&(window.onerror=n,r=!1),i&&(window.onunhandledrejection=o,i=!1))},l.traceKitWindowOnError=u,l}(),H=function(){var e=!1;function t(e){if(e.stack){for(var t,n,r,o,i=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,u=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),l=[],d=0,p=f.length;d<p;d+=1){if(i.exec(f[d])){var h=(r=i.exec(f[d]))[2]&&0===r[2].indexOf("native");t=r[2]&&0===r[2].indexOf("eval"),n=c.exec(r[2]),t&&n&&(r[2]=n[1],r[3]=n[2],r[4]=n[3]),o={args:h?[r[2]]:[],column:r[4]?+r[4]:void 0,func:r[1]||j,line:r[3]?+r[3]:void 0,url:h?void 0:r[2]}}else if(s.exec(f[d]))o={args:[],column:(r=s.exec(f[d]))[4]?+r[4]:void 0,func:r[1]||j,line:+r[3],url:r[2]};else{if(!a.exec(f[d]))continue;t=(r=a.exec(f[d]))[3]&&r[3].indexOf(" > eval")>-1,n=u.exec(r[3]),t&&n?(r[3]=n[1],r[4]=n[2],r[5]=void 0):0!==d||r[5]||void 0===e.columnNumber||(l[0].column=e.columnNumber+1),o={args:r[2]?r[2].split(","):[],column:r[5]?+r[5]:void 0,func:r[1]||j,line:r[4]?+r[4]:void 0,url:r[3]}}!o.func&&o.line&&(o.func=j),l.push(o)}if(l.length)return{stack:l,message:e.message,name:e.name}}}function n(e,t,n,r){var o={url:t,line:n?+n:void 0};if(o.url&&o.line){e.incomplete=!1;var i=e.stack;if(i.length>0&&i[0].url===o.url){if(i[0].line===o.line)return!1;if(!i[0].line&&i[0].func===o.func)return i[0].line=o.line,i[0].context=o.context,!1}return i.unshift(o),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,t){for(var o,i,a=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,s=[],u={},c=!1,f=r.caller;f&&!c;f=f.caller)f!==H&&f!==z&&(i={args:[],column:void 0,func:j,line:void 0,url:void 0},o=a.exec(f.toString()),f.name?i.func=f.name:o&&(i.func=o[1]),void 0===i.func&&(i.func=o?o.input.substring(0,o.input.indexOf("{")):void 0),u[""+f]?c=!0:u[""+f]=!0,s.push(i));t&&s.splice(0,t);var l={stack:s,message:e.message,name:e.name};return n(l,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),l}function o(n,o){var i,a=void 0===o?0:+o;try{if(i=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,i=t.split("\n"),a=[],s=0;s<i.length;s+=2){var u=void 0;r.exec(i[s])?u={args:[],column:void 0,func:(n=r.exec(i[s]))[3],line:+n[1],url:n[2]}:o.exec(i[s])&&(u={args:(n=o.exec(i[s]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),u&&(!u.func&&u.line&&(u.func=j),u.context=[i[s+1]],a.push(u))}if(a.length)return{stack:a,message:e.message,name:e.name}}}(n))return i}catch(t){if(e)throw t}try{if(i=t(n))return i}catch(t){if(e)throw t}try{if(i=function(e){var t=e.message.split("\n");if(!(t.length<4)){var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of function script\s*$/i,a=[],s=window&&window.document&&window.document.getElementsByTagName("script"),u=[];for(var c in s)U(s,c)&&!s[c].src&&u.push(s[c]);for(var f=2;f<t.length;f+=2){var l=void 0;if(r.exec(t[f]))l={args:[],column:void 0,func:(n=r.exec(t[f]))[3],line:+n[1],url:n[2]};else if(o.exec(t[f]))l={args:[],column:void 0,func:(n=o.exec(t[f]))[4],line:+n[1],url:n[3]};else if(i.exec(t[f])){n=i.exec(t[f]),l={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+n[1]}}l&&(l.func||(l.func=j),l.context=[t[f+1]],a.push(l))}if(a.length)return{stack:a,message:t[0],name:e.name}}}(n))return i}catch(t){if(e)throw t}try{if(i=r(n,a+1))return i}catch(t){if(e)throw t}return{message:n.message,name:n.name,stack:[]}}return o.augmentStackTraceWithInitialElement=n,o.computeStackTraceFromStackProp=t,o.ofCaller=function(e){var t=1+(void 0===e?0:+e);try{throw new Error}catch(e){return H(e,t+1)}},o}();var G=/[^\u0000-\u007F]/,F=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var K,q=function(){function e(e,t,n,r,o,i){void 0===i&&(i=y),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=o,this.beforeUnloadCallback=i,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=i(this.pushOnlyBuffer,(t=this.upsertBuffer,n=[],Object.keys(t).forEach((function(e){n.push(t[e])})),n));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,n},e.prototype.sizeInBytes=function(e){return G.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesSize;o>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(o)&&this.flush(),this.push(r,o,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=b(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(window.addEventListener(a.BEFORE_UNLOAD,Z(this.beforeUnloadCallback)),document.addEventListener(a.VISIBILITY_CHANGE,Z((function(){"hidden"===document.visibilityState&&e.flush()}))),window.addEventListener(a.BEFORE_UNLOAD,Z((function(){return e.flush()}))))},e}();!function(e){e.info="info",e.error="error"}(K||(K={}));var $,V,X,J={maxMessagesPerPage:0,sentMessageCount:0};function W(e){if(e.internalMonitoringEndpoint){var t=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new q(new F(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return g({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==$?$():{},e)}(e);n.add(r),t&&t.add(r)}}}(e);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(J,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){$=e}}}function Y(e,t,n){var r=n.value;n.value=function(){var e=J.batch?Z(r):r;return e.apply(this,arguments)}}function Z(e){return function(){try{return e.apply(this,arguments)}catch(e){ne(e);try{Q(e)}catch(e){ne(e)}}}}function Q(e){ee(r(r({},function(e){if(e instanceof Error){var t=H(e);return{error:{kind:t.name,stack:Ee(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+b(e)}}(e)),{status:K.error}))}function ee(e){J.batch&&J.sentMessageCount<J.maxMessagesPerPage&&(J.sentMessageCount+=1,J.batch.add(e))}function te(e){J.debugMode=e}function ne(e){J.debugMode&&console.warn("[INTERNAL ERROR]",e)}var re=[],oe=[];function ie(){return V||(!function(){if(!window.fetch)return;X=window.fetch,window.fetch=Z((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",i=R("object"==typeof e&&e.url||e),a={init:t,method:r,startTime:performance.now(),url:i},s=function(e){return t=n,r=void 0,s=function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return a.duration=performance.now()-a.startTime,"stack"in e||e instanceof Error?(a.status=0,a.response=Ee(H(e)),oe.forEach((function(e){return e(a)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];t=void 0,r.label=2;case 2:return r.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),t="Unable to retrieve response: "+n,[3,5];case 5:a.response=t,a.responseType=e.type,a.status=e.status,oe.forEach((function(e){return e(a)})),r.label=6;case 6:return[2]}}))},new((i=void 0)||(i=Promise))((function(e,n){function o(e){try{u(s.next(e))}catch(e){n(e)}}function a(e){try{u(s.throw(e))}catch(e){n(e)}}function u(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,a)}u((s=s.apply(t,r||[])).next())}));var t,r,i,s};re.forEach((function(e){return e(a)}));var u=X.call(this,e,a.init);return u.then(Z(s),Z(s)),u}))}(),V={beforeSend:function(e){re.push(e)},onRequestComplete:function(e){oe.push(e)}}),V}var ae,se,ue,ce,fe,le,de,pe,he,ve=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}(),ge=[],me=[];function ye(){return ae||(se=XMLHttpRequest.prototype.open,ue=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=Z((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:R(t)},se.apply(this,arguments)})),XMLHttpRequest.prototype.send=Z((function(e){var t=this;if(this._datadog_xhr){this._datadog_xhr.startTime=performance.now();var n=this.onreadystatechange;this.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&Z(o)(),n&&n.apply(this,arguments)};var r=!1,o=function(){r||(r=!0,t._datadog_xhr.duration=performance.now()-t._datadog_xhr.startTime,t._datadog_xhr.response=t.response,t._datadog_xhr.status=t.status,me.forEach((function(e){return e(t._datadog_xhr)})))};this.addEventListener("loadend",Z(o)),ge.forEach((function(e){return e(t._datadog_xhr,t)}))}return ue.apply(this,arguments)})),ae={beforeSend:function(e){ge.push(e)},onRequestComplete:function(e){me.push(e)}}),ae}function be(e){if(!fe){var t=new ve;!function(e,t){function n(n,r){D(r.url,e)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({context:{error:{origin:ce.NETWORK,stack:Te(r.response,e)||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url}},message:xe(n)+" error "+r.method+" "+r.url,startTime:r.startTime})}ye().onRequestComplete((function(e){return n(u.XHR,e)})),ie().onRequestComplete((function(e){return n(u.FETCH,e)}))}(e,t),function(e){le=console.error,console.error=Z((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];le.apply(console,i([t],n)),e.notify({context:{error:{origin:ce.CONSOLE}},message:i(["console error:",t],n).map(we).join(" "),startTime:performance.now()})}))}(t),function(e){de=function(t,n,r){e.notify(function(e,t){var n,r;void 0!==e.message||t instanceof Error?(n=e.message||"Empty message",r=Ee(e)):(n="Uncaught "+b(t),r="No stack, consider using an instance of Error");return{message:n,context:{error:{stack:r,kind:e.name,origin:ce.SOURCE}},startTime:performance.now()}}(t,r))},z.subscribe(de)}(t),fe=function(e,t){var n=0,r=new ve;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({context:{error:{origin:ce.AGENT}},message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,startTime:performance.now()}))})),setInterval((function(){return n=0}),f),r}(e,t)}return fe}function we(e){return"string"==typeof e?e:e instanceof Error?Ee(H(e)):b(e,0,2)}function Ee(e){var t=(e.name||"Error")+": "+e.message;return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",o=e.line?":"+e.line:"",i=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+o+i})),t}function Te(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function xe(e){return u.XHR===e?"XHR":"Fetch"}!function(e){e.AGENT="agent",e.CONSOLE="console",e.NETWORK="network",e.SOURCE="source",e.LOGGER="logger"}(ce||(ce={})),function(e){e.US="us",e.EU="eu"}(he||(he={}));var Oe,Se=((pe={})[he.EU]="datadoghq.eu",pe[he.US]="datadoghq.com",pe);function ke(e,t,n){var o=function(e,t){var n={applicationId:e.applicationId,buildMode:t.buildMode,clientToken:e.clientToken,env:e.env,proxyHost:e.proxyHost,sdkVersion:t.sdkVersion,service:e.service,site:e.site||Se[e.datacenter||t.datacenter],version:e.version},o=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],i=r({cookieOptions:B(e),isEnabled:function(e){return t=e,-1!==o.indexOf(t);var t},logsEndpoint:A("browser",n),proxyHost:e.proxyHost,rumEndpoint:A("rum",n),service:e.service,traceEndpoint:A("public-trace",n)},N);if(e.internalMonitoringApiKey&&(i.internalMonitoringEndpoint=A("browser",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(i.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(i.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(i.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(i.trackInteractions=!!e.trackInteractions),n.buildMode===Oe.E2E_TEST&&(i.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",i.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",i.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===Oe.STAGING&&void 0!==e.replica){var a=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:Se[he.US]});i.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:A("browser",a,"browser-agent-internal-monitoring"),logsEndpoint:A("browser",a),rumEndpoint:A("rum",a)}}return i}(e,t),i=W(o);return{configuration:o,errorObservable:n?be(o):new ve,internalMonitoring:i}}function Me(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}function _e(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t}}}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(Oe||(Oe={}));var Re,Le,Ce=1e4,Ie=function(){function e(e){void 0===e&&(e=Ce),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}();!function(e){e.debug="debug",e.info="info",e.warn="warn",e.error="error"}(Le||(Le={}));var Ne,Be=((Re={})[Le.debug]=0,Re[Le.info]=1,Re[Le.warn]=2,Re[Le.error]=3,Re);Object.keys(Le);!function(e){e.http="http",e.console="console",e.silent="silent"}(Ne||(Ne={}));var Ae=function(){function e(e,t,n,r){void 0===t&&(t=Ne.http),void 0===n&&(n=Le.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=_e(),this.contextManager.set(r)}return e.prototype.log=function(e,t,n){if(void 0===n&&(n=Le.info),Be[n]>=Be[this.level])switch(this.handlerType){case Ne.http:this.sendLog(r({message:e,status:n},g(this.contextManager.get(),t)));break;case Ne.console:console.log(n+": "+e);break;case Ne.silent:}},e.prototype.debug=function(e,t){this.log(e,t,Le.debug)},e.prototype.info=function(e,t){this.log(e,t,Le.info)},e.prototype.warn=function(e,t){this.log(e,t,Le.warn)},e.prototype.error=function(e,t){var n={error:{origin:ce.LOGGER}};this.log(e,g(n,t),Le.error)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.setLevel=function(e){this.level=e},function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);i>3&&a&&Object.defineProperty(t,n,a)}([Y],e.prototype,"log",null),e}(),De={buildMode:"release",datacenter:"us",sdkVersion:"1.24.1"},je="_dd",Pe="_dd_r",Ue="_dd_l",ze="rum",He="logs";var Ge="_dd_s",Fe=15*f,Ke=4*l,qe=f;function $e(e,t,n){var r=function(e,t){var n,r,o=!1,i=function(){o=!0,window.clearTimeout(n),n=window.setTimeout((function(){o=!1}),S)};return{get:function(){return o?r:(r=M(e),i(),r)},set:function(n,o){k(e,n,o,t),r=n,i()}}}(Ge,e);!function(e){var t=e.get(),n=M(je),r=M(Pe),o=M(Ue);if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i[He]=o),r&&/^[012]$/.test(r)&&(i[ze]=r),We(i,e)}}(r);var o=new ve,i=Je(r).id,s=function(e,t,n){var r,o=!n||void 0===n.leading||n.leading,i=!n||void 0===n.trailing||n.trailing,a=!1,s=!1;return{throttled:function(){var n=this;a?s=!0:(o?e.apply(this):s=!0,a=!0,r=window.setTimeout((function(){i&&s&&e.apply(n),a=!1,s=!1}),t))},cancel:function(){window.clearTimeout(r),a=!1,s=!1}}}((function(){var e=Je(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=m(),e.created=String(Date.now())),We(e,r),u&&i!==e.id&&(i=e.id,o.notify())}),S).throttled;return s(),function(e){var t=Z(e),n={capture:!0,passive:!0};[a.CLICK,a.TOUCH_START,a.KEY_DOWN,a.SCROLL].forEach((function(e){document.addEventListener(e,t,n),Ze.push((function(){return document.removeEventListener(e,t,n)}))}))}(s),function(e){var t=Z((function(){"visible"===document.visibilityState&&e()})),n=window.setInterval(t,qe);document.addEventListener(a.VISIBILITY_CHANGE,t),Ze.push((function(){clearInterval(n),document.removeEventListener(a.VISIBILITY_CHANGE,t)}))}((function(){We(Je(r),r)})),{getId:function(){return Je(r).id},getTrackingType:function(){return Je(r)[t]},renewObservable:o}}var Ve=/^([a-z]+)=([a-z0-9-]+)$/,Xe="&";function Je(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(Xe)||Ve.test(e))})(t)&&t.split(Xe).forEach((function(e){var t=Ve.exec(e);if(null!==t){var r=t[1],o=t[2];n[r]=o}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<Ke)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Ye(e),{})}function We(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+Fe);var r=function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}(e).map((function(e){return e[0]+"="+e[1]})).join(Xe);t.set(r,Fe)}else Ye(t)}function Ye(e){e.set("",0)}var Ze=[];var Qe,et="logs";function tt(e,t){if(!t){var n=nt(e)===Qe.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=$e(e.cookieOptions,et,(function(t){return function(e,t){var n=function(e){return e===Qe.NOT_TRACKED||e===Qe.TRACKED}(t)?t:nt(e);return{trackingType:n,isTracked:n===Qe.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===Qe.TRACKED}}}function nt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?Qe.TRACKED:Qe.NOT_TRACKED;var t}function rt(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(Qe||(Qe={}));var ot,it,at,st,ut=ct((function(e,t,n){var r=!1!==e.forwardErrorsToLogs,o=ke(e,De,r),i=o.configuration,a=o.internalMonitoring;return function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return g({session_id:r.getId()},i(),rt())}));var a=function(e,t){var n,r=o(e.logsEndpoint);void 0!==e.replica&&(n=o(e.replica.logsEndpoint));function o(t){return new q(new F(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(o,i){var a=function(e,t,n,r){return g(e,t,n,r)}({service:e.service,session_id:t.getId()},i,rt(),o);r.add(a),n&&n.add(a)}}}(e,r);return t.subscribe((function(e){return o.error(e.message,g({date:(t=e.startTime,Math.floor(E()+t))},e.context,rt(e.startTime)));var t})),function(e,t){r.isTracked()&&a.add(e,t)}}(i,o.errorObservable,a,tt(i,_(i.cookieOptions)),t,n)}));function ct(e){var t=!1,n=_e(),o={},i=new Ie,a=function(e,t){i.add([e,t])},s=new Ae(u);return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return te},enumerable:!1}),t}({logger:s,init:Z((function(r){Me()&&function(e){if(t)return e.silentMultipleInit||console.error("DD_LOGS is already initialized."),!1;if(!e||!e.publicApiKey&&!e.clientToken)return console.error("Client Token is not configured, we will not send any data."),!1;if(void 0!==e.sampleRate&&(n=e.sampleRate,!(function(e){return"number"==typeof e}(n)&&n>=0&&n<=100)))return console.error("Sample Rate should be a number between 0 and 100"),!1;var n;return!0}(r)&&(r.publicApiKey&&(r.clientToken=r.publicApiKey,console.warn("Public API Key is deprecated. Please use Client Token instead.")),a=e(r,s,n.get),i.drain((function(e){var t=e[0],n=e[1];return a(t,n)})),t=!0)})),setLoggerGlobalContext:Z(n.set),addLoggerGlobalContext:Z(n.add),removeLoggerGlobalContext:Z(n.remove),createLogger:Z((function(e,t){return void 0===t&&(t={}),o[e]=new Ae(u,t.handler,t.level,r(r({},t.context),{logger:{name:e}})),o[e]})),getLogger:Z((function(e){return o[e]}))});function u(e){a(e,g({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},n.get()))}}ot=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),at=ut,st=ot[it="DD_LOGS"],ot[it]=at,st&&st.q&&st.q.forEach((function(e){return e()}))}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"datadogLogs",(function(){return ut})),n.d(t,"makeLogsGlobal",(function(){return ct}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function o(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var a,s,u,c=1e3,f=60*c,l=60*f;!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.VISIBILITY_CHANGE="visibilitychange",e.DOM_CONTENT_LOADED="DOMContentLoaded"}(a||(a={})),function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(s||(s={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(u||(u={}));var d,p=function(e){return Array.isArray(e)},h=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function v(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length-1;r>=0;r-=1){var i=t[r];if(void 0!==i){if(void 0===e)if(h(i))e={};else{if(!p(i)){e=i;break}e=[]}if(h(e)&&h(i))for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=v(i[o],e[o]));else{if(!p(e)||!p(i))break;e.length=Math.max(e.length,i.length);for(var a=0;a<i.length;a+=1)e[a]=v(i[a],e[a])}}}return e}function g(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return v.apply(void 0,o([e],t.filter((function(e){return null!==e}))))}function m(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7+"-1000-4000-8000-100000000000").replace(/[018]/g,m)}function y(){}function b(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];w(e)&&(r=[!0,e.toJSON],delete e.toJSON);var i,o,a=[!1,void 0];"object"==typeof e&&w(i=Object.getPrototypeOf(e))&&(a=[!0,i.toJSON],delete i.toJSON);try{o=JSON.stringify(e,void 0,n)}catch(e){o="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(i.toJSON=a[1])}return o}function w(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function E(){return void 0===d&&(d=performance.timing.navigationStart),d}function T(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}var x,O,S=c;function k(e,t,n,r){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString(),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+o+";path=/;samesite="+a+s+u}function M(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}function _(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+m();return k(t,"test",c,e),"test"===M(t)}catch(e){return console.error(e),!1}}function R(e){return I(e,T(window.location)).href}function L(e,t){return C(e)===C(t)}function C(e){return T(I(e))}function I(e,t){if(function(){if(void 0!==O)return O;try{var e=new URL("http://test/path");return O="http://test/path"===e.href}catch(e){O=!1}return O}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var i=(n=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,n.head.appendChild(i),n.body.appendChild(r)}return r.href=e,r}var N={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*c,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function B(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===x){for(var e="dd_site_test_"+m(),t=window.location.hostname.split("."),n=t.pop();t.length&&!M(e);)n=t.pop()+"."+n,k(e,"test",c,{domain:n});x=n}return x}()),t}function A(e,t,n){var r="sdk_version:"+t.sdkVersion+(t.env?",env:"+t.env:"")+(t.service?",service:"+t.service:"")+(t.version?",version:"+t.version:""),i=e+"-http-intake.logs."+t.site,o=t.proxyHost?t.proxyHost:i,a=t.proxyHost?"ddhost="+i+"&":"",s=""+(t.applicationId?"_dd.application_id="+t.applicationId+"&":"")+a+"ddsource="+(n||"browser")+"&ddtags="+r;return"https://"+o+"/v1/input/"+t.clientToken+"?"+s}function D(e,t){return-1!==function(e){var t=I(e).pathname;return"/"===t[0]?t:"/"+t}(e).indexOf("/v1/input/")&&(L(e,t.logsEndpoint)||L(e,t.rumEndpoint)||L(e,t.traceEndpoint)||!!t.internalMonitoringEndpoint&&L(e,t.internalMonitoringEndpoint)||!!t.replica&&(L(e,t.replica.logsEndpoint)||L(e,t.replica.rumEndpoint)||L(e,t.replica.internalMonitoringEndpoint)))}var j=/[^\u0000-\u007F]/,P=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var U=function(){function e(e,t,n,r,i,o){void 0===o&&(o=y),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=i,this.beforeUnloadCallback=o,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=o(this.pushOnlyBuffer,(t=this.upsertBuffer,n=[],Object.keys(t).forEach((function(e){n.push(t[e])})),n));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,n},e.prototype.sizeInBytes=function(e){return j.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,i=n.messageBytesSize;i>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(i)&&this.flush(),this.push(r,i,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=b(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(window.addEventListener(a.BEFORE_UNLOAD,Z(this.beforeUnloadCallback)),document.addEventListener(a.VISIBILITY_CHANGE,Z((function(){"hidden"===document.visibilityState&&e.flush()}))),window.addEventListener(a.BEFORE_UNLOAD,Z((function(){return e.flush()}))))},e}(),z="?",H=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function G(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var F,K=function(){var e,t,n,r,i,o,a=[];function s(e,t,n){var r;for(var i in a)if(G(a,i))try{a[i](e,t,n)}catch(e){r=e}if(r)throw r}function u(e,r,i,o,a){if(t)q.augmentStackTraceWithInitialElement(t,r,i,""+e),f();else if(a)s(q(a),!0,a);else{var u,c={url:r,column:o,line:i},l=e;if("[object String]"==={}.toString.call(e)){var d=l.match(H);d&&(u=d[1],l=d[2])}s({name:u,message:l,stack:[c]},!0)}return!!n&&n.apply(this,arguments)}function c(e){var t=e.reason||"Empty reason";s(q(t),!0,t)}function f(){var n=t,r=e;t=void 0,e=void 0,s(n,!1,r)}function l(n){if(t){if(e===n)return;f()}var r=q(n);throw t=r,e=n,setTimeout((function(){e===n&&f()}),r.incomplete?2e3:0),n}return l.subscribe=function(e){!function(){if(r)return;n=window.onerror,window.onerror=Z(u),r=!0}(),function(){if(o)return;i=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=Z(c),o=!0}(),a.push(e)},l.unsubscribe=function(e){for(var t=a.length-1;t>=0;t-=1)a[t]===e&&a.splice(t,1);0===a.length&&(r&&(window.onerror=n,r=!1),o&&(window.onunhandledrejection=i,o=!1))},l.traceKitWindowOnError=u,l}(),q=function(){var e=!1;function t(e){if(e.stack){for(var t,n,r,i,o=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,u=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),l=[],d=0,p=f.length;d<p;d+=1){if(o.exec(f[d])){var h=(r=o.exec(f[d]))[2]&&0===r[2].indexOf("native");t=r[2]&&0===r[2].indexOf("eval"),n=c.exec(r[2]),t&&n&&(r[2]=n[1],r[3]=n[2],r[4]=n[3]),i={args:h?[r[2]]:[],column:r[4]?+r[4]:void 0,func:r[1]||z,line:r[3]?+r[3]:void 0,url:h?void 0:r[2]}}else if(s.exec(f[d]))i={args:[],column:(r=s.exec(f[d]))[4]?+r[4]:void 0,func:r[1]||z,line:+r[3],url:r[2]};else{if(!a.exec(f[d]))continue;t=(r=a.exec(f[d]))[3]&&r[3].indexOf(" > eval")>-1,n=u.exec(r[3]),t&&n?(r[3]=n[1],r[4]=n[2],r[5]=void 0):0!==d||r[5]||void 0===e.columnNumber||(l[0].column=e.columnNumber+1),i={args:r[2]?r[2].split(","):[],column:r[5]?+r[5]:void 0,func:r[1]||z,line:r[4]?+r[4]:void 0,url:r[3]}}!i.func&&i.line&&(i.func=z),l.push(i)}if(l.length)return{stack:l,message:e.message,name:e.name}}}function n(e,t,n,r){var i={url:t,line:n?+n:void 0};if(i.url&&i.line){e.incomplete=!1;var o=e.stack;if(o.length>0&&o[0].url===i.url){if(o[0].line===i.line)return!1;if(!o[0].line&&o[0].func===i.func)return o[0].line=i.line,o[0].context=i.context,!1}return o.unshift(i),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,t){for(var i,o,a=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,s=[],u={},c=!1,f=r.caller;f&&!c;f=f.caller)f!==q&&f!==K&&(o={args:[],column:void 0,func:z,line:void 0,url:void 0},i=a.exec(f.toString()),f.name?o.func=f.name:i&&(o.func=i[1]),void 0===o.func&&(o.func=i?i.input.substring(0,i.input.indexOf("{")):void 0),u[""+f]?c=!0:u[""+f]=!0,s.push(o));t&&s.splice(0,t);var l={stack:s,message:e.message,name:e.name};return n(l,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),l}function i(n,i){var o,a=void 0===i?0:+i;try{if(o=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=t.split("\n"),a=[],s=0;s<o.length;s+=2){var u=void 0;r.exec(o[s])?u={args:[],column:void 0,func:(n=r.exec(o[s]))[3],line:+n[1],url:n[2]}:i.exec(o[s])&&(u={args:(n=i.exec(o[s]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),u&&(!u.func&&u.line&&(u.func=z),u.context=[o[s+1]],a.push(u))}if(a.length)return{stack:a,message:e.message,name:e.name}}}(n))return o}catch(t){if(e)throw t}try{if(o=t(n))return o}catch(t){if(e)throw t}try{if(o=function(e){var t=e.message.split("\n");if(!(t.length<4)){var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of function script\s*$/i,a=[],s=window&&window.document&&window.document.getElementsByTagName("script"),u=[];for(var c in s)G(s,c)&&!s[c].src&&u.push(s[c]);for(var f=2;f<t.length;f+=2){var l=void 0;if(r.exec(t[f]))l={args:[],column:void 0,func:(n=r.exec(t[f]))[3],line:+n[1],url:n[2]};else if(i.exec(t[f]))l={args:[],column:void 0,func:(n=i.exec(t[f]))[4],line:+n[1],url:n[3]};else if(o.exec(t[f])){n=o.exec(t[f]),l={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+n[1]}}l&&(l.func||(l.func=z),l.context=[t[f+1]],a.push(l))}if(a.length)return{stack:a,message:t[0],name:e.name}}}(n))return o}catch(t){if(e)throw t}try{if(o=r(n,a+1))return o}catch(t){if(e)throw t}return{message:n.message,name:n.name,stack:[]}}return i.augmentStackTraceWithInitialElement=n,i.computeStackTraceFromStackProp=t,i.ofCaller=function(e){var t=1+(void 0===e?0:+e);try{throw new Error}catch(e){return q(e,t+1)}},i}();!function(e){e.info="info",e.error="error"}(F||(F={}));var $,V,X,J={maxMessagesPerPage:0,sentMessageCount:0};function W(e){if(e.internalMonitoringEndpoint){var t=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new U(new P(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return g({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==$?$():{},e)}(e);n.add(r),t&&t.add(r)}}}(e);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(J,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){$=e}}}function Y(e,t,n){var r=n.value;n.value=function(){var e=J.batch?Z(r):r;return e.apply(this,arguments)}}function Z(e){return function(){try{return e.apply(this,arguments)}catch(e){ne(e);try{Q(e)}catch(e){ne(e)}}}}function Q(e){ee(r(r({},function(e){if(e instanceof Error){var t=q(e);return{error:{kind:t.name,stack:Ee(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+b(e)}}(e)),{status:F.error}))}function ee(e){J.batch&&J.sentMessageCount<J.maxMessagesPerPage&&(J.sentMessageCount+=1,J.batch.add(e))}function te(e){J.debugMode=e}function ne(e){J.debugMode&&console.warn("[INTERNAL ERROR]",e)}var re,ie=[],oe=[];function ae(){return V||(!function(){if(!window.fetch)return;X=window.fetch,window.fetch=Z((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",o=R("object"==typeof e&&e.url||e),a={init:t,method:r,startTime:performance.now(),url:o},s=function(e){return t=n,r=void 0,s=function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return a.duration=performance.now()-a.startTime,"stack"in e||e instanceof Error?(a.status=0,a.response=Ee(q(e)),oe.forEach((function(e){return e(a)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];t=void 0,r.label=2;case 2:return r.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),t="Unable to retrieve response: "+n,[3,5];case 5:a.response=t,a.responseType=e.type,a.status=e.status,oe.forEach((function(e){return e(a)})),r.label=6;case 6:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,n){function i(e){try{u(s.next(e))}catch(e){n(e)}}function a(e){try{u(s.throw(e))}catch(e){n(e)}}function u(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(i,a)}u((s=s.apply(t,r||[])).next())}));var t,r,o,s};ie.forEach((function(e){return e(a)}));var u=X.call(this,e,a.init);return u.then(Z(s),Z(s)),u}))}(),V={beforeSend:function(e){ie.push(e)},onRequestComplete:function(e){oe.push(e)}}),V}var se,ue,ce=[],fe=[];function le(){return re||(se=XMLHttpRequest.prototype.open,ue=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=Z((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:R(t)},se.apply(this,arguments)})),XMLHttpRequest.prototype.send=Z((function(e){var t=this;if(this._datadog_xhr){this._datadog_xhr.startTime=performance.now();var n=this.onreadystatechange;this.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&Z(i)(),n&&n.apply(this,arguments)};var r=!1,i=function(){r||(r=!0,t._datadog_xhr.duration=performance.now()-t._datadog_xhr.startTime,t._datadog_xhr.response=t.response,t._datadog_xhr.status=t.status,fe.forEach((function(e){return e(t._datadog_xhr)})))};this.addEventListener("loadend",Z(i)),ce.forEach((function(e){return e(t._datadog_xhr,t)}))}return ue.apply(this,arguments)})),re={beforeSend:function(e){ce.push(e)},onRequestComplete:function(e){fe.push(e)}}),re}var de,pe,he,ve,ge,me,ye=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function be(e){if(!pe){var t=new ye;!function(e,t){function n(n,r){D(r.url,e)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({context:{error:{origin:de.NETWORK,stack:Te(r.response,e)||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url}},message:xe(n)+" error "+r.method+" "+r.url,startTime:r.startTime})}le().onRequestComplete((function(e){return n(u.XHR,e)})),ae().onRequestComplete((function(e){return n(u.FETCH,e)}))}(e,t),function(e){he=console.error,console.error=Z((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];he.apply(console,o([t],n)),e.notify({context:{error:{origin:de.CONSOLE}},message:o(["console error:",t],n).map(we).join(" "),startTime:performance.now()})}))}(t),function(e){ve=function(t,n,r){var i=function(e,t,n){if(!e||void 0===e.message&&!(t instanceof Error))return{kind:e&&e.name,message:n+" "+b(t),stack:"No stack, consider using an instance of Error"};return{kind:e.name,message:e.message||"Empty message",stack:Ee(e)}}(t,r,"Uncaught"),o=i.stack,a=i.message,s=i.kind;e.notify({message:a,context:{error:{kind:s,stack:o,origin:de.SOURCE}},startTime:performance.now()})},K.subscribe(ve)}(t),pe=function(e,t){var n=0,r=new ye;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({context:{error:{origin:de.AGENT}},message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,startTime:performance.now()}))})),setInterval((function(){return n=0}),f),r}(e,t)}return pe}function we(e){return"string"==typeof e?e:e instanceof Error?Ee(q(e)):b(e,0,2)}function Ee(e){var t=(e.name||"Error")+": "+e.message;return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",i=e.line?":"+e.line:"",o=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+i+o})),t}function Te(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function xe(e){return u.XHR===e?"XHR":"Fetch"}!function(e){e.AGENT="agent",e.CONSOLE="console",e.NETWORK="network",e.SOURCE="source",e.LOGGER="logger",e.CUSTOM="custom"}(de||(de={})),function(e){e.US="us",e.EU="eu"}(me||(me={}));var Oe,Se=((ge={})[me.EU]="datadoghq.eu",ge[me.US]="datadoghq.com",ge);function ke(e,t,n){var i=function(e,t){var n={applicationId:e.applicationId,buildMode:t.buildMode,clientToken:e.clientToken,env:e.env,proxyHost:e.proxyHost,sdkVersion:t.sdkVersion,service:e.service,site:e.site||Se[e.datacenter||t.datacenter],version:e.version},i=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],o=r({cookieOptions:B(e),isEnabled:function(e){return t=e,-1!==i.indexOf(t);var t},logsEndpoint:A("browser",n),proxyHost:e.proxyHost,rumEndpoint:A("rum",n),service:e.service,traceEndpoint:A("public-trace",n)},N);if(e.internalMonitoringApiKey&&(o.internalMonitoringEndpoint=A("browser",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(o.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(o.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(o.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(o.trackInteractions=!!e.trackInteractions),n.buildMode===Oe.E2E_TEST&&(o.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",o.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",o.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===Oe.STAGING&&void 0!==e.replica){var a=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:Se[me.US]});o.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:A("browser",a,"browser-agent-internal-monitoring"),logsEndpoint:A("browser",a),rumEndpoint:A("rum",a)}}return o}(e,t),o=W(i);return{configuration:i,errorObservable:n?be(i):new ye,internalMonitoring:o}}function Me(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}function _e(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t}}}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(Oe||(Oe={}));var Re,Le,Ce=1e4,Ie=function(){function e(e){void 0===e&&(e=Ce),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}();!function(e){e.debug="debug",e.info="info",e.warn="warn",e.error="error"}(Le||(Le={}));var Ne,Be=((Re={})[Le.debug]=0,Re[Le.info]=1,Re[Le.warn]=2,Re[Le.error]=3,Re);Object.keys(Le);!function(e){e.http="http",e.console="console",e.silent="silent"}(Ne||(Ne={}));var Ae=function(){function e(e,t,n,r){void 0===t&&(t=Ne.http),void 0===n&&(n=Le.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=_e(),this.contextManager.set(r)}return e.prototype.log=function(e,t,n){if(void 0===n&&(n=Le.info),Be[n]>=Be[this.level])switch(this.handlerType){case Ne.http:this.sendLog(r({message:e,status:n},g(this.contextManager.get(),t)));break;case Ne.console:console.log(n+": "+e);break;case Ne.silent:}},e.prototype.debug=function(e,t){this.log(e,t,Le.debug)},e.prototype.info=function(e,t){this.log(e,t,Le.info)},e.prototype.warn=function(e,t){this.log(e,t,Le.warn)},e.prototype.error=function(e,t){var n={error:{origin:de.LOGGER}};this.log(e,g(n,t),Le.error)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.setLevel=function(e){this.level=e},function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);o>3&&a&&Object.defineProperty(t,n,a)}([Y],e.prototype,"log",null),e}(),De="_dd",je="_dd_r",Pe="_dd_l",Ue="rum",ze="logs";var He="_dd_s",Ge=15*f,Fe=4*l,Ke=f;function qe(e,t,n){var r=function(e,t){var n,r,i=!1,o=function(){i=!0,window.clearTimeout(n),n=window.setTimeout((function(){i=!1}),S)};return{get:function(){return i?r:(r=M(e),o(),r)},set:function(n,i){k(e,n,i,t),r=n,o()}}}(He,e);!function(e){var t=e.get(),n=M(De),r=M(je),i=M(Pe);if(!t){var o={};n&&(o.id=n),i&&/^[01]$/.test(i)&&(o[ze]=i),r&&/^[012]$/.test(r)&&(o[Ue]=r),Je(o,e)}}(r);var i=new ye,o=Xe(r).id,s=function(e,t,n){var r,i=!n||void 0===n.leading||n.leading,o=!n||void 0===n.trailing||n.trailing,a=!1,s=!1;return{throttled:function(){var n=this;a?s=!0:(i?e.apply(this):s=!0,a=!0,r=window.setTimeout((function(){o&&s&&e.apply(n),a=!1,s=!1}),t))},cancel:function(){window.clearTimeout(r),a=!1,s=!1}}}((function(){var e=Xe(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=m(),e.created=String(Date.now())),Je(e,r),u&&o!==e.id&&(o=e.id,i.notify())}),S).throttled;return s(),function(e){var t=Z(e),n={capture:!0,passive:!0};[a.CLICK,a.TOUCH_START,a.KEY_DOWN,a.SCROLL].forEach((function(e){document.addEventListener(e,t,n),Ye.push((function(){return document.removeEventListener(e,t,n)}))}))}(s),function(e){var t=Z((function(){"visible"===document.visibilityState&&e()})),n=window.setInterval(t,Ke);document.addEventListener(a.VISIBILITY_CHANGE,t),Ye.push((function(){clearInterval(n),document.removeEventListener(a.VISIBILITY_CHANGE,t)}))}((function(){Je(Xe(r),r)})),{getId:function(){return Xe(r).id},getTrackingType:function(){return Xe(r)[t]},renewObservable:i}}var $e=/^([a-z]+)=([a-z0-9-]+)$/,Ve="&";function Xe(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(Ve)||$e.test(e))})(t)&&t.split(Ve).forEach((function(e){var t=$e.exec(e);if(null!==t){var r=t[1],i=t[2];n[r]=i}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<Fe)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(We(e),{})}function Je(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+Ge);var r=function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}(e).map((function(e){return e[0]+"="+e[1]})).join(Ve);t.set(r,Ge)}else We(t)}function We(e){e.set("",0)}var Ye=[];var Ze,Qe="logs";function et(e,t){if(!t){var n=tt(e)===Ze.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=qe(e.cookieOptions,Qe,(function(t){return function(e,t){var n=function(e){return e===Ze.NOT_TRACKED||e===Ze.TRACKED}(t)?t:tt(e);return{trackingType:n,isTracked:n===Ze.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===Ze.TRACKED}}}function tt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?Ze.TRACKED:Ze.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(Ze||(Ze={}));var nt={buildMode:"release",datacenter:"us",sdkVersion:"1.25.0"};function rt(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var it,ot,at,st,ut=ct((function(e,t,n){var r=!1!==e.forwardErrorsToLogs,i=ke(e,nt,r),o=i.configuration,a=i.internalMonitoring;return function(e,t,n,r,i,o){n.setExternalContextProvider((function(){return g({session_id:r.getId()},o(),rt())}));var a=function(e,t){var n,r=i(e.logsEndpoint);void 0!==e.replica&&(n=i(e.replica.logsEndpoint));function i(t){return new U(new P(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(i,o){var a=function(e,t,n,r){return g(e,t,n,r)}({service:e.service,session_id:t.getId()},o,rt(),i);r.add(a),n&&n.add(a)}}}(e,r);return t.subscribe((function(e){return i.error(e.message,g({date:(t=e.startTime,Math.floor(E()+t))},e.context,rt(e.startTime)));var t})),function(e,t){r.isTracked()&&a.add(e,t)}}(o,i.errorObservable,a,et(o,_(o.cookieOptions)),t,n)}));function ct(e){var t=!1,n=_e(),i={},o=new Ie,a=function(e,t){o.add([e,t])},s=new Ae(u);return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return te},enumerable:!1}),t}({logger:s,init:Z((function(r){Me()&&function(e){if(t)return e.silentMultipleInit||console.error("DD_LOGS is already initialized."),!1;if(!e||!e.publicApiKey&&!e.clientToken)return console.error("Client Token is not configured, we will not send any data."),!1;if(void 0!==e.sampleRate&&(n=e.sampleRate,!(function(e){return"number"==typeof e}(n)&&n>=0&&n<=100)))return console.error("Sample Rate should be a number between 0 and 100"),!1;var n;return!0}(r)&&(r.publicApiKey&&(r.clientToken=r.publicApiKey,console.warn("Public API Key is deprecated. Please use Client Token instead.")),a=e(r,s,n.get),o.drain((function(e){var t=e[0],n=e[1];return a(t,n)})),t=!0)})),setLoggerGlobalContext:Z(n.set),addLoggerGlobalContext:Z(n.add),removeLoggerGlobalContext:Z(n.remove),createLogger:Z((function(e,t){return void 0===t&&(t={}),i[e]=new Ae(u,t.handler,t.level,r(r({},t.context),{logger:{name:e}})),i[e]})),getLogger:Z((function(e){return i[e]}))});function u(e){a(e,g({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},n.get()))}}it=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),at=ut,st=it[ot="DD_LOGS"],it[ot]=at,st&&st.q&&st.q.forEach((function(e){return e()}))}]);
export { Datacenter } from '@datadog/browser-core';
export { StatusType, HandlerType, Logger, LogsMessage } from './logger';
export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './logs.entry';
export { StatusType, HandlerType, Logger, LogsMessage } from './domain/logger';
export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './boot/logs.entry';

@@ -5,8 +5,8 @@ "use strict";

exports.Datacenter = browser_core_1.Datacenter;
var logger_1 = require("./logger");
var logger_1 = require("./domain/logger");
exports.StatusType = logger_1.StatusType;
exports.HandlerType = logger_1.HandlerType;
exports.Logger = logger_1.Logger;
var logs_entry_1 = require("./logs.entry");
var logs_entry_1 = require("./boot/logs.entry");
exports.datadogLogs = logs_entry_1.datadogLogs;
//# sourceMappingURL=index.js.map
export { Datacenter } from '@datadog/browser-core';
export { StatusType, HandlerType, Logger, LogsMessage } from './logger';
export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './logs.entry';
export { StatusType, HandlerType, Logger, LogsMessage } from './domain/logger';
export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './boot/logs.entry';
export { Datacenter } from '@datadog/browser-core';
export { StatusType, HandlerType, Logger } from './logger';
export { datadogLogs } from './logs.entry';
export { StatusType, HandlerType, Logger } from './domain/logger';
export { datadogLogs } from './boot/logs.entry';
//# sourceMappingURL=index.js.map
{
"name": "@datadog/browser-logs",
"version": "1.24.1",
"version": "1.25.0",
"license": "Apache-2.0",

@@ -16,3 +16,3 @@ "main": "cjs/index.js",

"dependencies": {
"@datadog/browser-core": "1.24.1",
"@datadog/browser-core": "1.25.0",
"tslib": "^1.10.0"

@@ -29,3 +29,3 @@ },

},
"gitHead": "0eef20c05fe9654815b7c1599b8357cfeaa10ce5"
"gitHead": "3b66e416efe51c32cc0636fd57aa9cd8c90bf16b"
}

@@ -1,119 +0,511 @@

# `logs`
# Browser Log Collection
Datadog browser logs library.
Send logs to Datadog from web browsers or other Javascript clients with the `datadog-logs` client-side JavaScript logging library.
[Browser support](./BROWSER_SUPPORT.md#logger)
With the `datadog-logs` library, you can send logs directly to Datadog from JS clients and leverage the following features:
- Use the library as a logger. Everything is forwarded to Datadog as JSON documents.
- Add `context` and extra custom attributes to each log sent.
- Wrap and forward every frontend error automatically.
- Forward frontend errors.
- Record real client IP addresses and user agents.
- Optimized network usage with automatic bulk posts.
## Setup
**Datadog client token**: For security reasons, [API keys][1] cannot be used to configure the `datadog-logs` library, because they would be exposed client-side in the JavaScript code. To collect logs from web browsers, a [client token][2] must be used. See the [client token documentation][2] for more details.
**Datadog browser log library**: Configure the library through [NPM](#npm) or use the [CDN async](#cdn-async) or [CDN sync](#cdn-sync) code snippets in the head tag.
**Supported browsers**: The `datadog-logs` library supports all modern desktop and mobile browsers including IE10 and IE11. See the [browser support][4] table.
### NPM
```
After adding [`@datadog/browser-logs`][3] to your `package.json` file, initialize it with:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.init({
clientToken: 'XXX',
site: 'datadoghq.com',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
forwardErrorsToLogs: true,
sampleRate: 100
sampleRate: 100,
})
```
### Bundle
### CDN async
Load and configure the library in the head section of your pages.
<!-- prettier-ignore -->
```html
<html>
<head>
<title>Example to send logs to Datadog</title>
<script>
(function(h,o,u,n,d) {
h=h[d]=h[d]||{q:[],onReady:function(c){h.q.push(c)}}
d=o.createElement(u);d.async=1;d.src=n
n=o.getElementsByTagName(u)[0];n.parentNode.insertBefore(d,n)
})(window,document,'script','https://www.datadoghq-browser-agent.com/datadog-logs.js','DD_LOGS')
DD_LOGS.onReady(function() {
DD_LOGS.init({
clientToken: 'XXX',
site: 'datadoghq.com',
forwardErrorsToLogs: true,
sampleRate: 100,
})
})
</script>
</head>
</html>
```
<script src = 'https://www.datadoghq-browser-agent.com/datadog-logs.js'>
<script>
window.DD_LOGS.init({
clientToken: 'XXX',
site: 'datadoghq.com',
forwardErrorsToLogs: true,
sampleRate: 100
});
</script>
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
### CDN sync
To receive all logs and errors, load and configure the library at the beginning of the head section for your pages.
```html
<html>
<head>
<title>Example to send logs to Datadog</title>
<script type="text/javascript" src="https://www.datadoghq-browser-agent.com/datadog-logs.js"></script>
<script>
window.DD_LOGS &&
DD_LOGS.init({
clientToken: '<CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
forwardErrorsToLogs: true,
sampleRate: 100,
})
</script>
</head>
</html>
```
## Public API
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
What we call `Context` is a map `{key: value}` that will be added to the message context.
### TypeScript
- Init must be called before other methods.
Types are compatible with TypeScript >= 3.0. For earlier versions, import JS sources and use global variables to avoid any compilation issues:
- Configurable options:
```typescript
import '@datadog/browser-logs/bundle/datadog-logs'
- `forwardErrorsToLogs`: when truthy, we'll automatically forward `console.error` logs, uncaught exceptions and network errors.
- `sampleRate`: percentage of sessions to track. Only tracked sessions send logs.
- `site`: The site of the Datadog intake to send SDK data to (default: 'datadoghq.com', set to 'datadoghq.eu' to send data to the EU site)
- `silentMultipleInit`: prevent logging errors while having multiple Init
- `service`: name of the corresponding service
- `env`: environment of the service
- `version`: version of the service
window.DD_LOGS.init({
clientToken: '<CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
forwardErrorsToLogs: true,
sampleRate: 100,
})
```
- Options that must have matching configuration when using `rum` SDK:
## Configuration
- `trackSessionAcrossSubdomains`: preserve session across subdomains of the same site (default: `false`)
- `useSecureSessionCookie`: use a secure session cookie. This will disable session tracking on insecure (non-HTTPS) connections. (default: `false`)
- `useCrossSiteSessionCookie`: use a secure cross-site session cookie. This will allow the Logs SDK to run when the site is loaded from another one (ex: via an iframe). Implies `useSecureSessionCookie`. (default: `false`)
### Initialization parameters
```
init(configuration: {
clientToken: string,
site?: string,
forwardErrorsToLogs?: boolean,
sampleRate?: number,
silentMultipleInit?: boolean,
service?: string,
env?: string,
version?: string,
trackSessionAcrossSubdomains?: boolean,
useSecureSessionCookie?: boolean,
useCrossSiteSessionCookie?: boolean,
})
```
The following parameters are available to configure the Datadog browser log library to send logs to Datadog:
- Default logger
| Parameter | Type | Required | Default | Description |
| --------------------- | ------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------- |
| `clientToken` | String | Yes | | A [Datadog client token][2]. |
| `site` | String | Yes | `datadoghq.com` | The Datadog site of your organization. US: `datadoghq.com`, EU: `datadoghq.eu` |
| `service` | String | No | | The service name for your application. |
| `env` | String | No | | The application’s environment, for example: prod, pre-prod, staging, etc. |
| `version` | String | No | | The application’s version, for example: 1.2.3, 6c44da20, 2020.02.13, etc. |
| `forwardErrorsToLogs` | Boolean | No | `true` | Set to `false` to stop forwarding console.error logs, uncaught exceptions and network errors to Datadog. |
| `sampleRate` | Number | No | `100` | The percentage of sessions to track: `100` for all, `0` for none. Only tracked sessions send logs. |
| `silentMultipleInit` | Boolean | No | | Prevent logging errors while having multiple init. |
```
logger.debug | info | warn | error (message: string, messageContext = Context)`
logger.log (message: string, messageContext: Context, status? = 'debug' | 'info' | 'warn' | 'error')
logger.setLevel (level?: 'debug' | 'info' | 'warn' | 'error')
logger.setHandler (handler?: 'http' | 'console' | 'silent')
logger.addContext (key: string, value: any) # add one key-value to the logger context
logger.removeContext (key: string) # remove one key from the logger context
logger.setContext (context: Context) # entirely replace the logger context
```
Options that must have a matching configuration when using the `RUM` SDK:
- Custom loggers
| Parameter | Type | Required | Default | Description |
| ------------------------------ | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `trackSessionAcrossSubdomains` | Boolean | No | `false` | Preserve the session across subdomains for the same site. |
| `useSecureSessionCookie` | Boolean | No | `false` | Use a secure session cookie. This disables logs sent on insecure (non-HTTPS) connections. |
| `useCrossSiteSessionCookie` | Boolean | No | `false` | Use a secure cross-site session cookie. This allows the logs SDK to run when the site is loaded from another one (iframe). Implies `useSecureSessionCookie`. |
Custom loggers have the same API than the default logger
## Usage
```
createLogger (name: string, conf?: {
level?: 'debug' | 'info' | 'warn' | 'error'
handler?: 'http' | 'console' | 'silent'
context?: Context
}) # create a new logger
getLogger (name: string) # retrieve a previously created logger
```
### Custom logs
- Modify the global context for all loggers
```
addLoggerGlobalContext (key: string, value: any) # add one key-value to the default context
removeLoggerGlobalContext (key: string) # remove one key of the default context
setLoggerGlobalContext (context: Context) # entirely replace the default context
```
After the Datadog browser log library is initialized, send a custom log entry directly to Datadog with the API:
## TypeScript support
```
logger.debug | info | warn | error (message: string, messageContext = Context)
```
Types are compatible with TypeScript >= 3.0.
For earlier version, you can import js sources and use global variable to avoid any compilation issue:
#### NPM
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.logger.info('Button clicked', { name: 'buttonName', id: 123 })
```
import '@datadog/browser-logs/bundle/datadog-logs';
window.DD_LOGS.init({
clientToken: 'XXX',
site: 'datadoghq.com',
forwardErrorsToLogs: true,
sampleRate: 100
});
#### CDN async
```javascript
DD_LOGS.onReady(function() {
DD_LOGS.logger.info('Button clicked', { name: 'buttonName', id: 123 })
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
#### CDN sync
```javascript
window.DD_LOGS && DD_LOGS.logger.info('Button clicked', { name: 'buttonName', id: 123 })
```
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
#### Results
The results are the same when using NPM, CDN async or CDN sync:
```json
{
"status": "info",
"session_id": "1234",
"name": "buttonName",
"id": 123,
"message": "Button clicked",
"http": {
"url": "...",
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36"
},
"network": { "client": { "ip": "109.30.xx.xxx" } }
}
```
The logger adds the following information by default:
- `view.url`
- `session_id`
- `http.useragent`
- `network.client.ip`
### Status parameter
After the Datadog browser log library is initialized, send a custom log entry to Datadog with the API using the status as a parameter:
```
log (message: string, messageContext: Context, status? = 'debug' | 'info' | 'warn' | 'error')
```
#### NPM
For NPM, use:
```javascript
import { datadogLogs } from '@datadog/browser-logs';
datadogLogs.logger.log(<MESSAGE>,<JSON_ATTRIBUTES>,<STATUS>);
```
#### CDN async
For CDN async, use:
```javascript
DD_LOGS.onReady(function() {
DD_LOGS.logger.log(<MESSAGE>,<JSON_ATTRIBUTES>,<STATUS>);
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
#### CDN sync
For CDN sync, use:
```javascript
window.DD_LOGS && DD_LOGS.logger.log(<MESSAGE>,<JSON_ATTRIBUTES>,<STATUS>);
```
#### Placeholders
The placeholders in the examples above are described below:
| Placeholder | Description |
| ------------------- | --------------------------------------------------------------------------------------- |
| `<MESSAGE>` | The message of your log that is fully indexed by Datadog. |
| `<JSON_ATTRIBUTES>` | A valid JSON object, which includes all attributes attached to the `<MESSAGE>`. |
| `<STATUS>` | The status of your log; accepted status values are `debug`, `info`, `warn`, or `error`. |
## Advanced usage
### Define multiple loggers
The Datadog browser log library contains a default logger, but it is possible to define different loggers.
#### Create a new logger
After the Datadog browser log library is initialized, use the API `createLogger` to define a new logger:
```text
createLogger (name: string, conf?: {
level?: 'debug' | 'info' | 'warn' | 'error'
handler?: 'http' | 'console' | 'silent'
context?: Context
})
```
**Note**: These parameters can be set with the [setLevel](#filter-by-status), [setHandler](#change-the-destination), and [setContext](#overwrite-context) APIs.
#### Get a custom logger
After the creation of a logger, access it in any part of your JavaScript code with the API:
```javascript
getLogger (name: string)
```
##### NPM
For example, assume there is a `signupLogger`, defined with all the other loggers:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.createLogger('signupLogger', 'info', 'http', { env: 'staging' })
```
It can now be used in a different part of the code with:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
const signupLogger = datadogLogs.getLogger('signupLogger')
signupLogger.info('Test sign up completed')
```
#### CDN async
For example, assume there is a `signupLogger`, defined with all the other loggers:
```javascript
DD_LOGS.onReady(function() {
const signupLogger = DD_LOGS.createLogger('signupLogger', 'info', 'http', { env: 'staging' })
})
```
It can now be used in a different part of the code with:
```javascript
DD_LOGS.onReady(function() {
const signupLogger = DD_LOGS.getLogger('signupLogger')
signupLogger.info('Test sign up completed')
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
##### CDN sync
For example, assume there is a `signupLogger`, defined with all the other loggers:
```javascript
if (window.DD_LOGS) {
const signupLogger = DD_LOGS.createLogger('signupLogger', 'info', 'http', { env: 'staging' })
}
```
It can now be used in a different part of the code with:
```javascript
if (window.DD_LOGS) {
const signupLogger = DD_LOGS.getLogger('signupLogger')
signupLogger.info('Test sign up completed')
}
```
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
### Overwrite context
#### Global context
After the Datadog browser log library is initialized, it is possible to:
- Set the entire context for all your loggers with the `setLoggerGlobalContext (context: Context)` API.
- Add a context to all your loggers with `addLoggerGlobalContext (key: string, value: any)` API.
##### NPM
For NPM, use:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.setLoggerGlobalContext("{'env': 'staging'}")
datadogLogs.addLoggerGlobalContext('referrer', document.referrer)
```
#### CDN async
For CDN async, use:
```javascript
DD_LOGS.onReady(function() {
DD_LOGS.setLoggerGlobalContext({ env: 'staging' })
})
DD_LOGS.onReady(function() {
window.DD_LOGS && DD_LOGS.addLoggerGlobalContext('referrer', document.referrer)
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
##### CDN sync
For CDN sync, use:
```javascript
window.DD_LOGS && DD_LOGS.setLoggerGlobalContext({ env: 'staging' })
window.DD_LOGS && DD_LOGS.addLoggerGlobalContext('referrer', document.referrer)
```
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
#### Logger context
After a logger is created, it is possible to:
- Set the entire context for your logger with the `setContext (context: Context)` API.
- Add a context to your logger with `addContext (key: string, value: any)` API:
##### NPM
For NPM, use:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.setContext("{'env': 'staging'}")
datadogLogs.addContext('referrer', document.referrer)
```
#### CDN async
For CDN async, use:
```javascript
DD_LOGS.onReady(function() {
DD_LOGS.setContext("{'env': 'staging'}")
})
DD_LOGS.onReady(function() {
DD_LOGS.addContext('referrer', document.referrer)
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
##### CDN sync
For CDN sync, use:
```javascript
window.DD_LOGS && DD_LOGS.setContext("{'env': 'staging'}")
window.DD_LOGS && DD_LOGS.addContext('referrer', document.referrer)
```
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
### Filter by status
After the Datadog browser log library is initialized, the minimal log level for your logger is set with the API:
```
setLevel (level?: 'debug' | 'info' | 'warn' | 'error')
```
Only logs with a status equal to or higher than the specified level are sent.
##### NPM
For NPM, use:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.logger.setLevel('<LEVEL>')
```
#### CDN async
For CDN async, use:
```javascript
DD_LOGS.onReady(function() {
DD_LOGS.logger.setLevel('<LEVEL>')
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
##### CDN sync
For CDN sync, use:
```javascript
window.DD_LOGS && DD_LOGS.logger.setLevel('<LEVEL>')
```
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
### Change the destination
By default, loggers created by the Datadog browser log library are sending logs to Datadog. After the Datadog browser log library is initialized, it is possible to configure the logger to send logs to the `console`, or to not send logs at all (`silent`) using to the API:
```
setHandler (handler?: 'http' | 'console' | 'silent')
```
##### NPM
For NPM, use:
```javascript
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.logger.setHandler('<HANDLER>')
```
#### CDN async
For CDN async, use:
```javascript
DD_LOGS.onReady(function() {
DD_LOGS.logger.setHandler('<HANDLER>')
})
```
**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
##### CDN sync
For CDN sync, use:
```javascript
window.DD_LOGS && DD_LOGS.logger.setHandler('<HANDLER>')
```
**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
[1]: /account_management/api-app-keys/#api-keys
[2]: /account_management/api-app-keys/#client-tokens
[3]: https://www.npmjs.com/package/@datadog/browser-logs
[4]: https://github.com/DataDog/browser-sdk/blob/master/packages/logs/BROWSER_SUPPORT.md
export { Datacenter } from '@datadog/browser-core'
export { StatusType, HandlerType, Logger, LogsMessage } from './logger'
export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './logs.entry'
export { StatusType, HandlerType, Logger, LogsMessage } from './domain/logger'
export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './boot/logs.entry'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc