mirror of
https://github.com/rxliuli/apps.apple.com.git
synced 2025-11-09 15:10:34 +00:00
3 lines
3.0 KiB
JavaScript
3 lines
3.0 KiB
JavaScript
import{r as i,a as _}from"./mt-metricskit-utils-private.esm~DkzakSThTT.js";function f(t){this.key=t}f.prototype.toString=function(){return this.key};var l={flagArguments:{INCLUDE_CALL_STACK:new f("INCLUDE_CALL_STACK"),MIRROR_TO_SERVER:new f("MIRROR_TO_SERVER"),SUPPRESS_CLIENT_OUTPUT:new f("SUPPRESS_CLIENT_OUTPUT")},setDelegate:function(e){return i.attachDelegate(this,e)},execute:function(e,n,o){var a=e.levelStringToIntMap[n];if(e.level()!==e.NONE&&e.level()<=a){var u=Array.prototype.slice.call(o),s=l.nonFlagLogArguments(u),v=l.logOptions(e,a,u),h=v.includeCallStack?new Error().stack:null,c=h?s.concat("\n"+h):s;if(e[n]._lastLog=c,v.mirrorToServer,v.throwInsteadOfPrint)throw new Error(s.toString());v.suppressClientOutput||(console[n]?console[n].apply(console,c):console.log.apply(console,c))}},isFlagObject:function(e){return e&&e===l.flagArguments[e.toString()]},nonFlagLogArguments:function(e){return e.filter(function(n){return!l.isFlagObject(n)})},logOptions:function(e,n,o){var a={},u;return o.forEach(function(s){l.isFlagObject(s)&&(u=_.snakeCaseToCamelCase(s.toString()),a[u]=!0)}),i.isFunction(e.mirrorToServerLevel)&&e.mirrorToServerLevel()!==e.NONE&&e.mirrorToServerLevel()<=n&&(a.mirrorToServer=!0),e.throwLevel()!==e.NONE&&e.throwLevel()<=n&&(a.throwInsteadOfPrint=!0),a},sendToServer:function(e,n,o,a){}},p={NONE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},L={MIN_LEVEL:p.NONE,MAX_LEVEL:p.ERROR,levelIntToStringMap:{0:"none",1:"debug",2:"info",3:"warn",4:"error"},levelStringToIntMap:{none:0,debug:1,info:2,warn:3,error:4}};i.extend(L,p);var g={loggerName:"defaultLogger",level:L.INFO,throwLevel:L.NONE},E=!1,S={};function r(t){this._loggerName=t,this._level,this._throwLevel,E||(E=!0,i.extend(r.prototype,L),i.extend(r.prototype,l.flagArguments))}function O(t){t=t||g.loggerName;var e=S[t];return e||(e=new r(t),S[t]=e),e}r.level=function(){return g.level};r.throwLevel=function(){return g.throwLevel};r.prototype.setDelegate=function(e){return i.attachDelegate(this,e)};r.prototype.loggerName=function(){return this._loggerName};r.prototype.levelParameterAsInt=function(e){var n=null,o;return i.isString(e)?o=this.levelStringToIntMap[e.toLowerCase()]:i.isNumber(e)&&(o=e),o>=this.MIN_LEVEL&&o<=this.MAX_LEVEL&&(n=o),n};r.prototype.setLevel=function(e){var n=this.levelParameterAsInt(e);n!==null&&(this._level=n)};r.prototype.setThrowLevel=function(e){var n=this.levelParameterAsInt(e);n!==null&&(this._throwLevel=n)};r.prototype.level=function(){var e=this._level;return i.isNumber(e)?e:r.level()};r.prototype.levelString=function(){return this.levelIntToStringMap[this.level()]};r.prototype.throwLevel=function(){var e=this._throwLevel;return i.isNumber(e)?e:r.throwLevel()};r.prototype.debug=function(){l.execute(this,"debug",arguments)};r.prototype.info=function(){l.execute(this,"info",arguments)};r.prototype.warn=function(){l.execute(this,"warn",arguments)};r.prototype.error=function(){l.execute(this,"error",arguments)};r.prototype.lastLog=function(e){return this[e]?this[e]._lastLog:null};export{r as L,O as l};
|
|
//# sourceMappingURL=mt-client-logger-core.esm~-rJfHcY8Zf.js.map
|