LogModel.js 837 B

1234
  1. export default class LogModel extends SDK.SDKModel{constructor(target){super(target);target.registerLogDispatcher(this);this._logAgent=target.logAgent();this._logAgent.enable();if(!Host.isUnderTest()){this._logAgent.startViolationsReport([{name:'longTask',threshold:200},{name:'longLayout',threshold:30},{name:'blockedEvent',threshold:100},{name:'blockedParser',threshold:-1},{name:'handler',threshold:150},{name:'recurringHandler',threshold:50},{name:'discouragedAPIUse',threshold:-1}]);}}
  2. entryAdded(payload){this.dispatchEventToListeners(Events.EntryAdded,{logModel:this,entry:payload});}
  3. requestClear(){this._logAgent.clear();}}
  4. export const Events={EntryAdded:Symbol('EntryAdded')};self.SDK=self.SDK||{};SDK=SDK||{};SDK.LogModel=LogModel;SDK.LogModel.Events=Events;SDK.SDKModel.register(SDK.LogModel,SDK.Target.Capability.Log,true);