1import{A as te,B as Y,C as O,F as re,b as ne,G as oe,N as se,H as k,I as J,J as ae,K as ie,E as v,L as ce,M as le,O as ue,P,e as de,Q as ge,R as D,T as _,U as m,V as fe,W as pe,X as W,Y as Ce,Z as j,_ as be,$ as me,a0 as xe,a1 as ye,p as he,a2 as Ee,a3 as Se,a4 as N,a5 as Te,a6 as Le,a7 as ve,a8 as Re,a9 as ke,a as Ie,g as we,d as Q,aa as F,ab as Ae,u as V,ac as _e,ad as Oe,ae as Pe,af as De,ag as Ue,q as z,ah as M,ai as He,aj as Me,v as Z,ak as Be,al as Ge,am as Ne,an as Fe,ao as ze,ap as B,aq as Ke,ar as We,as as je,at as $e,au as Xe,r as K,av as Ye,aw as Je,w as Qe,ax as Ve,ay as Ze,az as g,aA as q,aB as qe,aC as et,aD as tt,aE as rt,aF as nt,aG as C,aH as w,aI as ot,aJ as st,aK as b,aL as at}from"./configuration-BIB4Y30h.js";function U(e,r,n){const o=n.getHandler(),t=Array.isArray(o)?o:[o];return $[e]>=$[n.getLevel()]&&t.includes(r)}const c={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},$={[c.ok]:0,[c.debug]:1,[c.info]:2,[c.notice]:4,[c.warn]:5,[c.error]:6,[c.critical]:7,[c.alert]:8,[c.emerg]:9};function H(e,{includeMessage:r=!1}={}){return{stack:e.stack,kind:e.type,message:r?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}const A={console:"console",http:"http",silent:"silent"},it=Object.keys(c);var x=class{constructor(e,r,n=A.http,o=c.debug,t={}){this.handleLogStrategy=e,this.handlerType=n,this.level=o,this.contextManager=te("logger"),this.tags=[],this.contextManager.setContext(t),r&&this.contextManager.setContextProperty("logger",{name:r})}logImplementation(e,r,n=c.info,o,t){Y(()=>{const s=O(r);let l,i;if(o!=null){const a=re({originalError:o,nonErrorPrefix:se.PROVIDED,source:v.LOGGER,handling:oe.HANDLED,startClocks:ne()});i=a.debugIds,l=k({error:H(a,{includeMessage:!0})},a.context,s)}else l=s;this.handleLogStrategy({message:O(e),context:l,status:n,...i?{debugIds:i}:{}},this,t)})}log(e,r,n=c.info,o){let t;U(n,A.http,this)&&(t=J("log")),this.logImplementation(e,r,n,o,t)}setContext(e){this.contextManager.setContext(e)}getContext(){return this.contextManager.getContext()}setContextProperty(e,r){this.contextManager.setContextProperty(e,r)}removeContextProperty(e){this.contextManager.removeContextProperty(e)}clearContext(){this.contextManager.clearContext()}addTag(e,r){this.tags.push(ae(e,r))}removeTagsWithKey(e){const r=ie(e);this.tags=this.tags.filter(n=>n!==r&&!n.startsWith(`${r}:`))}getTags(){return this.tags.slice()}setHandler(e){this.handlerType=e}getHandler(){return this.handlerType}setLevel(e){this.level=e}getLevel(){return this.level}};x.prototype.ok=T(c.ok);x.prototype.debug=T(c.debug);x.prototype.info=T(c.info);x.prototype.notice=T(c.notice);x.prototype.warn=T(c.warn);x.prototype.error=T(c.error);x.prototype.critical=T(c.critical);x.prototype.alert=T(c.alert);x.prototype.emerg=T(c.emerg);function T(e){return function(r,n,o){let t;U(e,A.http,this)&&(t=J("log")),this.logImplementation(r,n,e,o,t)}}function X(){return ce?{}:{view:{referrer:document.referrer,url:window.location.href}}}function ee(e,r,n){if(e)for(const o of e){const t=o[r];t&&t(n)}}const ct=le;function lt(e,r,n,o,t,s){const l=it.concat(["custom"]),i={};l.forEach(a=>{i[a]=ge(a,t,s)}),r.subscribe(0,({rawLogsEvent:a,savedCommonContext:d=void 0,domainContext:f,ddtags:p=[]})=>{var S;const I=ue(a.date),y=d||o(),u={startTime:I,rawLogsEvent:a,domainContext:f},L=n.assembleEventDefaults.trigger(u);
1if(L===P)return;const R=n.assembleEvent.trigger(u);if(R===P)return;const h=de(e),E=k({view:y.view},L,a,R,{ddtags:h.concat(p).join(",")});((S=e.beforeSend)==null?void 0:S.call(e,E,f))===!1||E.origin!==v.AGENT&&(i[E.status]??i.custom).isLimitReached()||r.notify(1,E)})}const ut={[m.log]:c.info,[m.debug]:c.debug,[m.info]:c.info,[m.warn]:c.warn,[m.error]:c.error};function dt(e,r,n){const o=n.subscribe(({data:t,type:s})=>{var i;if(s!==D.CONSOLE||!e.forwardConsoleLogs.includes(t.api))return;const l={rawLogsEvent:k({date:_(),message:t.message,origin:v.CONSOLE,error:t.error&&H(t.error),_dd:t.error&&{debug_ids:t.error.debugIds},status:ut[t.api]},(i=t.error)==null?void 0:i.context),domainContext:{handlingStack:t.handlingStack}};r.notify(0,l)});return{stop:()=>o.unsubscribe()}}function gt(e,r){const n=fe(e.forwardReports).subscribe(o=>{let t=o.message,s;const l=o.originalError.type==="deprecation"?c.warn:c.error;l===c.error?s=H(o):o.stack&&(t+=` Found in ${pe(o.stack)}`),r.notify(0,{rawLogsEvent:{date:_(),message:t,origin:v.REPORT,error:s,_dd:{debug_ids:o.debugIds},status:l}})});return{stop:()=>{n.unsubscribe()}}}const ft=32*Te;function pt(e,r,n){if(!e.forwardErrorsToLogs)return{stop:W};Ce({responseBodyAction:l=>t(l)?j.COLLECT:j.IGNORE});const o=n.subscribe(({data:l,type:i})=>{i===D.FETCH&&l.state==="resolve"?s(N.FETCH,l):i===D.XHR&&l.state==="complete"&&s(N.XHR,l)});function t(l){return!me(l.url)&&!l.isAborted&&(Ct(l)||be(l.status))}function s(l,i){if(!t(i))return;const a="error"in i&&i.error?xe(i.error):void 0,d=a?ye(a):i.responseBody||"Failed to load",f=a?he(Ee(a)):void 0,p={handlingStack:i.handlingStack};r.notify(0,{rawLogsEvent:{message:`${bt(l)} error ${i.method} ${i.url}`,date:i.startClocks.timeStamp,error:{stack:Se(d,ft,"..."),handling:void 0},_dd:{debug_ids:f},http:{method:i.method,status_code:i.status,url:i.url},status:c.error,origin:v.NETWORK},domainContext:p})}return{stop:()=>o.unsubscribe()}}function Ct(e){return e.status===0&&e.responseType!=="opaque"}function bt(e){return N.XHR===e?"XHR":"Fetch"}function mt(e,r,n){if(!e.forwardErrorsToLogs)return{stop:W};const o=n.subscribe(t=>{if(t.type===D.RUNTIME_ERROR){const s=t.data;r.notify(0,{rawLogsEvent:k({message:s.message,date:s.startClocks.timeStamp,error:H(s),_dd:{debug_ids:s.debugIds},origin:v.SOURCE,status:c.error},s.context)})}});return{stop:()=>{o.unsubscribe()}}}function xt(e){function r(n,o,t,s,l){const i=k(o.getContext(),n.context);if(U(n.status,A.console,o)&&ht(n,i),U(n.status,A.http,o)){const a={rawLogsEvent:k({date:l||_(),message:n.message,status:n.status,origin:v.LOGGER,_dd:{debug_ids:n.debugIds}},i),savedCommonContext:s,ddtags:o.getTags()};t&&(a.domainContext={handlingStack:t}),e.notify(0,a)}}return{handleLog:r}}const yt={[c.ok]:m.debug,[c.debug]:m.debug,[c.info]:m.info,[c.notice]:m.info,[c.warn]:m.warn,[c.error]:m.error,[c.critical]:m.error,[c.alert]:m.error,[c.emerg]:m.error};function ht({status:e,message:r},n){Le[yt[e]].call(ve,r,n)}function Et(e,r,n,o){const t=[Ie(e,"logs")],s=Re(e,"logs");s&&t.push(s);const l=ke({endpoints:t,reportError:n});return o.expireObservable.subscribe(()=>l.forceFlush("session_expire")),r.subscribe(1,i=>{l.add(i)}),l}function St(e){const r=we();e.subscribe(1,n=>{r.send("log",n)})}function Tt(e){return{get:r=>{const n=e.findTrackedSession(r);if(n)return{session_id:n.id}}}}function Lt(e){return r=>{e.notify(0,{rawLogsEvent:{message:r,date:_(),origin:v.AGENT,status:c.error}}),Q("Error reported to customer",{"error.message":r})}}function vt(e){const r=V;e.assembleEventDefaults.register(({startTime:t})=>{const s=n(t);return s||F}),e.assembleTelemetry.register(({startTime:t})=>{var l,i;const s=n(t);return s?{application:{id:s.application_id},view:{id:(l=s.view)==null?void 0:l.id},action:{id:(i=s.user_action)==null?void 0:i.id}}:F});function n(t){const s=o(t,Ae()?r.DD_RUM_SYNTHETICS:r.DD_RUM);if(s)return s}function o(t,s){if(s!=null&&s.getInternalContext)return s.getInternalContext(t)}}function Rt(e,r,n){e.register(({startTime:o})=>{const t=n.findTrackedSession(o);return n.findTrackedSession(o,{returnInactive:!0,maxAge:1/0})?{service:r.service,session_id:t?t.id:void 0,session:t?{id:t.id}:void 0}:P})}const G="logs";function kt(e,r,n,o,t){const s=new ct,l=[];s.subscribe(1,y=>_e("logs",y));const i=Lt(s),{assembleEventDefaults:a}=t;Rt(a,e,r);
1const d=Oe(a,e,G),f=Pe(a,e,r,G),p=De(a,e,G,!1);vt(t),Ue(a),pt(e,s,o),mt(e,s,o),dt(e,s,o),o.unbuffer(),gt(e,s);const{handleLog:I}=xt(s);if(lt(e,s,t,n,i),z())St(s);else{const{stop:y}=Et(e,s,i,r);l.push(()=>y())}return{handleLog:I,getInternalContext:Tt(r).get,accountContext:d,globalContext:p,userContext:f,stop:()=>{l.forEach(y=>y())}}}function It(){return{assembleEventDefaults:M(),assembleTelemetry:M(),assembleEvent:M()}}const wt={...Ne,forwardErrorsToLogs:{type:"boolean",default:!0,strict:!1},forwardConsoleLogs:{type:"enum",values:m,multiple:!0,allowAll:!0,default:[]},forwardReports:{type:"enum",values:Ge,multiple:!0,allowAll:!0,default:[]},plugins:{type:"schema",multiple:!0,strict:!1,default:[],schema:{name:{type:"string",required:!0},getConfigurationTelemetry:{type:"function",strict:!1,signature:void 0},onInit:{type:"function",strict:!1,signature:void 0},onLogsStart:{type:"function",strict:!1,signature:void 0}}}};function At(e){const r=He(e,wt,Z);if(r)return{...r,beforeSend:r.beforeSend?Me(r.beforeSend,"beforeSend threw an error:"):void 0}}function _t(e){var n;const r=Be(e);return{forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,plugins:(n=e.plugins)==null?void 0:n.map(o=>{var t;return{name:o.name,...(t=o.getConfigurationTelemetry)==null?void 0:t.call(o)}}),...r}}function Ot(e,r){function n(){return r.isGranted()?F:P}e.assembleEventDefaults.register(n),e.assembleTelemetry.register(n)}function Pt(e,r,n,o){const t=new Fe(500,u=>{Q("preStartLogs buffer data lost",{count:u})}),s=ze();B(s,g.globalContext,t);const l=Ke();B(l,g.accountContext,t);const i=We();B(i,g.userContext,t);let a,d,f;const p=It(),I=r.observable.subscribe(y);function y(){if(!d||!a||!f)return;I.unsubscribe();const u=n(d,f,p);t.subscribe(L=>L(u)),t.unbuffer()}return{init(u,L,R){if(!u){Z.error("Missing configuration");return}if(je(u.enableExperimentalFeatures),$e(u.allowUntrustedEvents),z()&&(u=Dt(u)),a=u,d){q("DD_LOGS",u);return}ee(u.plugins,"onInit",{initConfiguration:u,publicApi:L,registerAssembleEventHook:p.assembleEvent.register});const h=At(u);!h||!Xe(h,R??"")||(d=h,r.tryToInit(h.trackingConsent),r.onGrantedOnce(()=>{Ot(p,r),K(qe)(Ye.LOGS,h,p.assembleTelemetry,o);const E=S=>{f=S,Ve(p.assembleTelemetry,f),Ze(_t(u)),y()};z()?E(Je()):K(et)(h,r).then(S=>{S&&E(S)}).catch(Qe)}))},get initConfiguration(){return a},globalContext:s,accountContext:l,userContext:i,getInternalContext:W,handleLog(u,L,R,h=e(),E=_()){t.notify(S=>S.handleLog(u,L,R,h,E))}}}function Dt(e){return{...e,clientToken:"empty"}}function Ut(e={}){const r=nt(),n=tt().observable;let o=Pt(X,r,(a,d,f)=>{const p=K(kt)(a,d,X,n,f);return o=Ht(o,p),ee(a.plugins,"onLogsStart",{handleLog:p.handleLog}),p},e.sdkName);const t=()=>o,s={},l=new x((...a)=>o.handleLog(...a)),i=rt({logger:l,init:a=>{const d=new Error().stack;Y(()=>o.init(a,i,d))},setTrackingConsent:w(a=>{r.update(a),st({feature:"set-tracking-consent",tracking_consent:a})}),getGlobalContext:C(t,g.globalContext,b.getContext),setGlobalContext:C(t,g.globalContext,b.setContext),setGlobalContextProperty:C(t,g.globalContext,b.setContextProperty),removeGlobalContextProperty:C(t,g.globalContext,b.removeContextProperty),clearGlobalContext:C(t,g.globalContext,b.clearContext),createLogger:w((a,d={})=>(s[a]=new x((...f)=>o.handleLog(...f),O(a),d.handler,d.level,O(d.context)),s[a])),getLogger:w(a=>s[a]),getInitConfiguration:w(()=>ot(o.initConfiguration)),getInternalContext:w(a=>o.getInternalContext(a)),setUser:C(t,g.userContext,b.setContext),getUser:C(t,g.userContext,b.getContext),setUserProperty:C(t,g.userContext,b.setContextProperty),removeUserProperty:C(t,g.userContext,b.removeContextProperty),clearUser:C(t,g.userContext,b.clearContext),setAccount:C(t,g.accountContext,b.setContext),getAccount:C(t,g.accountContext,b.getContext),setAccountProperty:C(t,g.accountContext,b.setContextProperty),removeAccountProperty:C(t,g.accountContext,b.removeContextProperty),clearAccount:C(t,g.accountContext,b.clearContext)});return i}function Ht(e,r){return{...e,init:n=>{q("DD_LOGS",n)},getInternalContext:r.getInternalContext,globalContext:r.globalContext,userContext:r.userContext,accountContext:r.accountContext}}const Mt=Ut({sdkName:"logs"});at(V,"DD_LOGS",Mt);export{A as HandlerType,x as Logger,c as StatusType,Mt as datadogLogs}; 2//# sourceMappingURL=main-Cmf8QRGw.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.