@tencentcloud/ai-desk-customer-wechat
Version:
AI Desk customer UIKit for wechat mini program
3 lines (2 loc) • 1.52 kB
JavaScript
;const i=require("./console.js"),o=require("./time.js"),c=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()},u=function(t){return typeof Array.isArray=="function"?Array.isArray(t):c(t)==="array"},a=function(t){return t!==null&&typeof t=="object"},g=function(t){return t instanceof Error},f=function(t){return u(t)||a(t)};function l(t){const n=t.toString().length;let e;switch(n){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t;break}return e}function h(){return"ai-desk-customer"}function m(){const t=o.getDate();return t.toLocaleTimeString("en-US",{hour12:!1})+"."+l(t.getMilliseconds())}const y={arguments2String(t){let n="";if(t.length===1)n=t[0];else for(let e=0,s=t.length;e<s;e++){if(f(t[e]))try{n+=g(t[e])?JSON.stringify(t[e],["message","code"]):JSON.stringify(t[e])}catch(r){n+=r?r.message:"";break}else n+=t[e];n+=" "}return n},_exec(t,n){i.console[t](`${h()} ${m()} ${n}`)},d:function(){const t=this.arguments2String(arguments);this._exec("debug",t)},l:function(){const t=this.arguments2String(arguments);this._exec("log",t)},log:function(){const t=this.arguments2String(arguments);this._exec("log",t)},i:function(){const t=this.arguments2String(arguments);this._exec("info",t)},w:function(){const t=this.arguments2String(arguments);this._exec("warn",t)},e:function(){const t=this.arguments2String(arguments);this._exec("error",t)}};exports.Log=y;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/ai-desk-customer-uniapp/utils/logger.js.map