@walletconnect/logger
Advanced tools
Comparing version 2.1.1 to 2.1.2-98c4166
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("pino"),h=require("@walletconnect/safe-json"),O=require("stream");function I(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var u=I(n);const c={level:"info"},s="custom_context",i=1e3*1024;class S{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class d{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new S(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class L{constructor(e,t=i){this.level=e??"error",this.levelValue=n.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===n.levels.values.error?console.error(e):t===n.levels.values.warn?console.warn(e):t===n.levels.values.debug?console.debug(e):t===n.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(h.safeJsonStringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(h.safeJsonStringify({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class B{constructor(e,t=i){this.baseChunkLogger=new L(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class x extends O.Writable{constructor(e,t=i){super({objectMode:!0}),this.baseChunkLogger=new L(e,t)}_write(e,t,o){try{this.baseChunkLogger.appendToLogs(e),o()}catch(l){o(l)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var T=Object.defineProperty,m=Object.defineProperties,E=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,v=(r,e,t)=>e in r?T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))z.call(e,t)&&v(r,t,e[t]);if(f)for(var t of f(e))A.call(e,t)&&v(r,t,e[t]);return r},a=(r,e)=>m(r,E(e));function k(r){return a(g({},r),{level:r?.level||c.level})}function p(r,e=s){return r[e]||""}function b(r,e,t=s){return r[t]=e,r}function y(r,e=s){let t="";return typeof r.bindings>"u"?t=p(r,e):t=r.bindings().context||"",t}function _(r,e,t=s){const o=y(r,t);return o.trim()?`${o}/${e}`:e}function N(r,e,t=s){const o=_(r,e,t),l=r.child({context:o});return b(l,o,t)}function w(r){var e,t;const o=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(a(g({},r.opts),{level:"trace",browser:a(g({},(t=r.opts)==null?void 0:t.browser),{write:l=>o.write(l)})})),chunkLoggerController:o}}function C(r){var e;const t=new x((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(a(g({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function j(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?w(r):C(r)}Object.defineProperty(exports,"pino",{enumerable:!0,get:function(){return u.default}}),exports.MAX_LOG_SIZE_IN_BYTES_DEFAULT=i,exports.PINO_CUSTOM_CONTEXT_KEY=s,exports.PINO_LOGGER_DEFAULTS=c,exports.formatChildLoggerContext=_,exports.generateChildLogger=N,exports.generateClientLogger=w,exports.generatePlatformLogger=j,exports.generateServerLogger=C,exports.getBrowserLoggerContext=p,exports.getDefaultLoggerOptions=k,exports.getLoggerContext=y,exports.setBrowserLoggerContext=b; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("pino"),h=require("@walletconnect/safe-json");function O(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var u=O(n);const c={level:"info"},s="custom_context",l=1e3*1024;class I{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class d{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new I(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class L{constructor(e,t=l){this.level=e??"error",this.levelValue=n.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===n.levels.values.error?console.error(e):t===n.levels.values.warn?console.warn(e):t===n.levels.values.debug?console.debug(e):t===n.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(h.safeJsonStringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(h.safeJsonStringify({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class S{constructor(e,t=l){this.baseChunkLogger=new L(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B{constructor(e,t=l){this.baseChunkLogger=new L(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var T=Object.defineProperty,x=Object.defineProperties,m=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,v=(r,e,t)=>e in r?T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,i=(r,e)=>{for(var t in e||(e={}))E.call(e,t)&&v(r,t,e[t]);if(f)for(var t of f(e))z.call(e,t)&&v(r,t,e[t]);return r},g=(r,e)=>x(r,m(e));function A(r){return g(i({},r),{level:r?.level||c.level})}function p(r,e=s){return r[e]||""}function b(r,e,t=s){return r[t]=e,r}function y(r,e=s){let t="";return typeof r.bindings>"u"?t=p(r,e):t=r.bindings().context||"",t}function w(r,e,t=s){const o=y(r,t);return o.trim()?`${o}/${e}`:e}function k(r,e,t=s){const o=w(r,e,t),a=r.child({context:o});return b(a,o,t)}function C(r){var e,t;const o=new S((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(g(i({},r.opts),{level:"trace",browser:g(i({},(t=r.opts)==null?void 0:t.browser),{write:a=>o.write(a)})})),chunkLoggerController:o}}function _(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(g(i({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function N(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C(r):_(r)}Object.defineProperty(exports,"pino",{enumerable:!0,get:function(){return u.default}}),exports.MAX_LOG_SIZE_IN_BYTES_DEFAULT=l,exports.PINO_CUSTOM_CONTEXT_KEY=s,exports.PINO_LOGGER_DEFAULTS=c,exports.formatChildLoggerContext=w,exports.generateChildLogger=k,exports.generateClientLogger=C,exports.generatePlatformLogger=N,exports.generateServerLogger=_,exports.getBrowserLoggerContext=p,exports.getDefaultLoggerOptions=A,exports.getLoggerContext=y,exports.setBrowserLoggerContext=b; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import h,{levels as i}from"pino";import{default as D}from"pino";import{safeJsonStringify as u}from"@walletconnect/safe-json";import{Writable as I}from"stream";const c={level:"info"},n="custom_context",l=1e3*1024;class O{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class d{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new O(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class L{constructor(e,t=l){this.level=e??"error",this.levelValue=i.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===i.values.error?console.error(e):t===i.values.warn?console.warn(e):t===i.values.debug?console.debug(e):t===i.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(u({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(u({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class B{constructor(e,t=l){this.baseChunkLogger=new L(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class x extends I{constructor(e,t=l){super({objectMode:!0}),this.baseChunkLogger=new L(e,t)}_write(e,t,o){try{this.baseChunkLogger.appendToLogs(e),o()}catch(s){o(s)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var S=Object.defineProperty,_=Object.defineProperties,T=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,f=(r,e,t)=>e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))z.call(e,t)&&f(r,t,e[t]);if(p)for(var t of p(e))k.call(e,t)&&f(r,t,e[t]);return r},a=(r,e)=>_(r,T(e));function E(r){return a(g({},r),{level:r?.level||c.level})}function b(r,e=n){return r[e]||""}function v(r,e,t=n){return r[t]=e,r}function y(r,e=n){let t="";return typeof r.bindings>"u"?t=b(r,e):t=r.bindings().context||"",t}function w(r,e,t=n){const o=y(r,t);return o.trim()?`${o}/${e}`:e}function A(r,e,t=n){const o=w(r,e,t),s=r.child({context:o});return v(s,o,t)}function m(r){var e,t;const o=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(a(g({},r.opts),{level:"trace",browser:a(g({},(t=r.opts)==null?void 0:t.browser),{write:s=>o.write(s)})})),chunkLoggerController:o}}function C(r){var e;const t=new x((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(a(g({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function N(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?m(r):C(r)}export{l as MAX_LOG_SIZE_IN_BYTES_DEFAULT,n as PINO_CUSTOM_CONTEXT_KEY,c as PINO_LOGGER_DEFAULTS,w as formatChildLoggerContext,A as generateChildLogger,m as generateClientLogger,N as generatePlatformLogger,C as generateServerLogger,b as getBrowserLoggerContext,E as getDefaultLoggerOptions,y as getLoggerContext,D as pino,v as setBrowserLoggerContext}; | ||
import h,{levels as s}from"pino";import{default as U}from"pino";import{safeJsonStringify as u}from"@walletconnect/safe-json";const c={level:"info"},n="custom_context",l=1e3*1024;class O{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class d{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new O(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class L{constructor(e,t=l){this.level=e??"error",this.levelValue=s.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===s.values.error?console.error(e):t===s.values.warn?console.warn(e):t===s.values.debug?console.debug(e):t===s.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(u({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(u({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class m{constructor(e,t=l){this.baseChunkLogger=new L(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B{constructor(e,t=l){this.baseChunkLogger=new L(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var x=Object.defineProperty,S=Object.defineProperties,_=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,f=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,i=(r,e)=>{for(var t in e||(e={}))T.call(e,t)&&f(r,t,e[t]);if(p)for(var t of p(e))z.call(e,t)&&f(r,t,e[t]);return r},g=(r,e)=>S(r,_(e));function k(r){return g(i({},r),{level:r?.level||c.level})}function v(r,e=n){return r[e]||""}function b(r,e,t=n){return r[t]=e,r}function y(r,e=n){let t="";return typeof r.bindings>"u"?t=v(r,e):t=r.bindings().context||"",t}function w(r,e,t=n){const o=y(r,t);return o.trim()?`${o}/${e}`:e}function E(r,e,t=n){const o=w(r,e,t),a=r.child({context:o});return b(a,o,t)}function C(r){var e,t;const o=new m((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(g(i({},r.opts),{level:"trace",browser:g(i({},(t=r.opts)==null?void 0:t.browser),{write:a=>o.write(a)})})),chunkLoggerController:o}}function I(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(g(i({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function A(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C(r):I(r)}export{l as MAX_LOG_SIZE_IN_BYTES_DEFAULT,n as PINO_CUSTOM_CONTEXT_KEY,c as PINO_LOGGER_DEFAULTS,w as formatChildLoggerContext,E as generateChildLogger,C as generateClientLogger,A as generatePlatformLogger,I as generateServerLogger,v as getBrowserLoggerContext,k as getDefaultLoggerOptions,y as getLoggerContext,U as pino,b as setBrowserLoggerContext}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
(function(g,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("stream")):typeof define=="function"&&define.amd?define(["exports","stream"],O):(g=typeof globalThis<"u"?globalThis:g||self,O(g["@walletconnect/logger"]={},g.stream))})(this,function(g,O){"use strict";function W(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var Q=ee;function ee(e,t,r){var s=r&&r.stringify||W,i=1;if(typeof e=="object"&&e!==null){var a=t.length+i;if(a===1)return e;var c=new Array(a);c[0]=s(e);for(var d=1;d<a;d++)c[d]=s(t[d]);return c.join(" ")}if(typeof e!="string")return e;var n=t.length;if(n===0)return e;for(var u="",f=1-i,l=-1,z=e&&e.length||0,o=0;o<z;){if(e.charCodeAt(o)===37&&o+1<z){switch(l=l>-1?l:0,e.charCodeAt(o+1)){case 100:case 102:if(f>=n||t[f]==null)break;l<o&&(u+=e.slice(l,o)),u+=Number(t[f]),l=o+2,o++;break;case 105:if(f>=n||t[f]==null)break;l<o&&(u+=e.slice(l,o)),u+=Math.floor(Number(t[f])),l=o+2,o++;break;case 79:case 111:case 106:if(f>=n||t[f]===void 0)break;l<o&&(u+=e.slice(l,o));var h=typeof t[f];if(h==="string"){u+="'"+t[f]+"'",l=o+2,o++;break}if(h==="function"){u+=t[f].name||"<anonymous>",l=o+2,o++;break}u+=s(t[f]),l=o+2,o++;break;case 115:if(f>=n)break;l<o&&(u+=e.slice(l,o)),u+=String(t[f]),l=o+2,o++;break;case 37:l<o&&(u+=e.slice(l,o)),u+="%",l=o+2,o++,f--;break}++f}++o}return l===-1?e:(l<z&&(u+=e.slice(l)),u)}const N=Q;var b=v;const _=ce().console||{},te={mapHttpRequest:E,mapHttpResponse:E,wrapRequestSerializer:B,wrapResponseSerializer:B,wrapErrorSerializer:B,req:E,res:E,err:oe};function re(e,t){return Array.isArray(e)?e.filter(function(s){return s!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function v(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||_;e.browser.write&&(e.browser.asObject=!0);const s=e.serializers||{},i=re(e.browser.serialize,s);let a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);const c=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),e.enabled===!1&&(e.level="silent");const d=e.level||"info",n=Object.create(r);n.log||(n.log=p),Object.defineProperty(n,"levelVal",{get:f}),Object.defineProperty(n,"level",{get:l,set:z});const u={transmit:t,serialize:i,asObject:e.browser.asObject,levels:c,timestamp:le(e)};n.levels=v.levels,n.level=d,n.setMaxListeners=n.getMaxListeners=n.emit=n.addListener=n.on=n.prependListener=n.once=n.prependOnceListener=n.removeListener=n.removeAllListeners=n.listeners=n.listenerCount=n.eventNames=n.write=n.flush=p,n.serializers=s,n._serialize=i,n._stdErrSerialize=a,n.child=o,t&&(n._logEvent=A());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function l(){return this._level}function z(h){if(h!=="silent"&&!this.levels.values[h])throw Error("unknown level "+h);this._level=h,L(u,n,"error","log"),L(u,n,"fatal","error"),L(u,n,"warn","error"),L(u,n,"info","log"),L(u,n,"debug","log"),L(u,n,"trace","log")}function o(h,j){if(!h)throw new Error("missing bindings for child Pino");j=j||{},i&&h.serializers&&(j.serializers=h.serializers);const J=j.serializers;if(i&&J){var I=Object.assign({},s,J),H=e.browser.serialize===!0?Object.keys(I):i;delete h.serializers,S([h],H,I,this._stdErrSerialize)}function K(m){this._childLevel=(m._childLevel|0)+1,this.error=y(m,h,"error"),this.fatal=y(m,h,"fatal"),this.warn=y(m,h,"warn"),this.info=y(m,h,"info"),this.debug=y(m,h,"debug"),this.trace=y(m,h,"trace"),I&&(this.serializers=I,this._serialize=H),t&&(this._logEvent=A([].concat(m._logEvent.bindings,h)))}return K.prototype=this,new K(this)}return n}v.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},v.stdSerializers=te,v.stdTimeFunctions=Object.assign({},{nullTime:x,epochTime:P,unixTime:ae,isoTime:ue});function L(e,t,r,s){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?p:i[r]?i[r]:_[r]||_[s]||p,ne(e,t,r)}function ne(e,t,r){!e.transmit&&t[r]===p||(t[r]=function(s){return function(){const a=e.timestamp(),c=new Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_?_:this;for(var n=0;n<c.length;n++)c[n]=arguments[n];if(e.serialize&&!e.asObject&&S(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?s.call(d,se(this,r,c,a)):s.apply(d,c),e.transmit){const u=e.transmit.level||t.level,f=v.levels.values[u],l=v.levels.values[r];if(l<f)return;ie(this,{ts:a,methodLevel:r,methodValue:l,transmitLevel:u,transmitValue:v.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},c)}}}(t[r]))}function se(e,t,r,s){e._serialize&&S(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let a=i[0];const c={};s&&(c.time=s),c.level=v.levels.values[t];let d=(e._childLevel|0)+1;if(d<1&&(d=1),a!==null&&typeof a=="object"){for(;d--&&typeof i[0]=="object";)Object.assign(c,i.shift());a=i.length?N(i.shift(),i):void 0}else typeof a=="string"&&(a=N(i.shift(),i));return a!==void 0&&(c.msg=a),c}function S(e,t,r,s){for(const i in e)if(s&&e[i]instanceof Error)e[i]=v.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i]))for(const a in e[i])t&&t.indexOf(a)>-1&&a in r&&(e[i][a]=r[a](e[i][a]))}function y(e,t,r){return function(){const s=new Array(1+arguments.length);s[0]=t;for(var i=1;i<s.length;i++)s[i]=arguments[i-1];return e[r].apply(this,s)}}function ie(e,t,r){const s=t.send,i=t.ts,a=t.methodLevel,c=t.methodValue,d=t.val,n=e._logEvent.bindings;S(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(u){return n.indexOf(u)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=c,s(a,e._logEvent,d),e._logEvent=A(n)}function A(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function oe(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)t[r]===void 0&&(t[r]=e[r]);return t}function le(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?x:P}function E(){return{}}function B(e){return e}function p(){}function x(){return!1}function P(){return Date.now()}function ae(){return Math.round(Date.now()/1e3)}function ue(){return new Date(Date.now()).toISOString()}function ce(){function e(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}const V={level:"info"},w="custom_context",C=1e3*1024;class fe{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class M{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const r=new fe(t);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let r=this.head;for(;r!==null;)t.push(r.value),r=r.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const r=t.value;return t=t.next,{done:!1,value:r}}}}}const he=e=>JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString()+"n":r);function D(e){return typeof e=="string"?e:he(e)||""}class ${constructor(t,r=C){this.level=t??"error",this.levelValue=b.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new M(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,r){r===b.levels.values.error?console.error(t):r===b.levels.values.warn?console.warn(t):r===b.levels.values.debug?console.debug(t):r===b.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(D({timestamp:new Date().toISOString(),log:t}));const r=typeof t=="string"?JSON.parse(t).level:t.level;r>=this.levelValue&&this.forwardToConsole(t,r)}getLogs(){return this.logs}clearLogs(){this.logs=new M(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const r=this.getLogArray();return r.push(D({extraMetadata:t})),new Blob(r,{type:"application/json"})}}class ge{constructor(t,r=C){this.baseChunkLogger=new $(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const r=URL.createObjectURL(this.logsToBlob(t)),s=document.createElement("a");s.href=r,s.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}class de extends O.Writable{constructor(t,r=C){super({objectMode:!0}),this.baseChunkLogger=new $(t,r)}_write(t,r,s){try{this.baseChunkLogger.appendToLogs(t),s()}catch(i){s(i)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var ve=Object.defineProperty,be=Object.defineProperties,me=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,U=(e,t,r)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))Le.call(t,r)&&U(e,r,t[r]);if(G)for(var r of G(t))ye.call(t,r)&&U(e,r,t[r]);return e},k=(e,t)=>be(e,me(t));function we(e){return k(T({},e),{level:e?.level||V.level})}function F(e,t=w){return e[t]||""}function R(e,t,r=w){return e[r]=t,e}function X(e,t=w){let r="";return typeof e.bindings>"u"?r=F(e,t):r=e.bindings().context||"",r}function Y(e,t,r=w){const s=X(e,r);return s.trim()?`${s}/${t}`:t}function Oe(e,t,r=w){const s=Y(e,t,r),i=e.child({context:s});return R(i,s,r)}function q(e){var t,r;const s=new ge((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace",browser:k(T({},(r=e.opts)==null?void 0:r.browser),{write:i=>s.write(i)})})),chunkLoggerController:s}}function Z(e){var t;const r=new de((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace"})),chunkLoggerController:r}}function _e(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?q(e):Z(e)}g.MAX_LOG_SIZE_IN_BYTES_DEFAULT=C,g.PINO_CUSTOM_CONTEXT_KEY=w,g.PINO_LOGGER_DEFAULTS=V,g.formatChildLoggerContext=Y,g.generateChildLogger=Oe,g.generateClientLogger=q,g.generatePlatformLogger=_e,g.generateServerLogger=Z,g.getBrowserLoggerContext=F,g.getDefaultLoggerOptions=we,g.getLoggerContext=X,g.pino=b,g.setBrowserLoggerContext=R,Object.defineProperty(g,"__esModule",{value:!0})}); | ||
(function(g,O){typeof exports=="object"&&typeof module<"u"?O(exports):typeof define=="function"&&define.amd?define(["exports"],O):(g=typeof globalThis<"u"?globalThis:g||self,O(g["@walletconnect/logger"]={}))})(this,function(g){"use strict";function O(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var Q=W;function W(e,t,r){var s=r&&r.stringify||O,i=1;if(typeof e=="object"&&e!==null){var a=t.length+i;if(a===1)return e;var c=new Array(a);c[0]=s(e);for(var d=1;d<a;d++)c[d]=s(t[d]);return c.join(" ")}if(typeof e!="string")return e;var n=t.length;if(n===0)return e;for(var u="",f=1-i,l=-1,z=e&&e.length||0,o=0;o<z;){if(e.charCodeAt(o)===37&&o+1<z){switch(l=l>-1?l:0,e.charCodeAt(o+1)){case 100:case 102:if(f>=n||t[f]==null)break;l<o&&(u+=e.slice(l,o)),u+=Number(t[f]),l=o+2,o++;break;case 105:if(f>=n||t[f]==null)break;l<o&&(u+=e.slice(l,o)),u+=Math.floor(Number(t[f])),l=o+2,o++;break;case 79:case 111:case 106:if(f>=n||t[f]===void 0)break;l<o&&(u+=e.slice(l,o));var h=typeof t[f];if(h==="string"){u+="'"+t[f]+"'",l=o+2,o++;break}if(h==="function"){u+=t[f].name||"<anonymous>",l=o+2,o++;break}u+=s(t[f]),l=o+2,o++;break;case 115:if(f>=n)break;l<o&&(u+=e.slice(l,o)),u+=String(t[f]),l=o+2,o++;break;case 37:l<o&&(u+=e.slice(l,o)),u+="%",l=o+2,o++,f--;break}++f}++o}return l===-1?e:(l<z&&(u+=e.slice(l)),u)}const N=Q;var b=v;const _=ue().console||{},ee={mapHttpRequest:E,mapHttpResponse:E,wrapRequestSerializer:B,wrapResponseSerializer:B,wrapErrorSerializer:B,req:E,res:E,err:ie};function te(e,t){return Array.isArray(e)?e.filter(function(s){return s!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function v(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||_;e.browser.write&&(e.browser.asObject=!0);const s=e.serializers||{},i=te(e.browser.serialize,s);let a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);const c=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),e.enabled===!1&&(e.level="silent");const d=e.level||"info",n=Object.create(r);n.log||(n.log=p),Object.defineProperty(n,"levelVal",{get:f}),Object.defineProperty(n,"level",{get:l,set:z});const u={transmit:t,serialize:i,asObject:e.browser.asObject,levels:c,timestamp:oe(e)};n.levels=v.levels,n.level=d,n.setMaxListeners=n.getMaxListeners=n.emit=n.addListener=n.on=n.prependListener=n.once=n.prependOnceListener=n.removeListener=n.removeAllListeners=n.listeners=n.listenerCount=n.eventNames=n.write=n.flush=p,n.serializers=s,n._serialize=i,n._stdErrSerialize=a,n.child=o,t&&(n._logEvent=A());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function l(){return this._level}function z(h){if(h!=="silent"&&!this.levels.values[h])throw Error("unknown level "+h);this._level=h,y(u,n,"error","log"),y(u,n,"fatal","error"),y(u,n,"warn","error"),y(u,n,"info","log"),y(u,n,"debug","log"),y(u,n,"trace","log")}function o(h,j){if(!h)throw new Error("missing bindings for child Pino");j=j||{},i&&h.serializers&&(j.serializers=h.serializers);const J=j.serializers;if(i&&J){var I=Object.assign({},s,J),H=e.browser.serialize===!0?Object.keys(I):i;delete h.serializers,S([h],H,I,this._stdErrSerialize)}function K(L){this._childLevel=(L._childLevel|0)+1,this.error=m(L,h,"error"),this.fatal=m(L,h,"fatal"),this.warn=m(L,h,"warn"),this.info=m(L,h,"info"),this.debug=m(L,h,"debug"),this.trace=m(L,h,"trace"),I&&(this.serializers=I,this._serialize=H),t&&(this._logEvent=A([].concat(L._logEvent.bindings,h)))}return K.prototype=this,new K(this)}return n}v.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},v.stdSerializers=ee,v.stdTimeFunctions=Object.assign({},{nullTime:P,epochTime:x,unixTime:le,isoTime:ae});function y(e,t,r,s){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?p:i[r]?i[r]:_[r]||_[s]||p,re(e,t,r)}function re(e,t,r){!e.transmit&&t[r]===p||(t[r]=function(s){return function(){const a=e.timestamp(),c=new Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_?_:this;for(var n=0;n<c.length;n++)c[n]=arguments[n];if(e.serialize&&!e.asObject&&S(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?s.call(d,ne(this,r,c,a)):s.apply(d,c),e.transmit){const u=e.transmit.level||t.level,f=v.levels.values[u],l=v.levels.values[r];if(l<f)return;se(this,{ts:a,methodLevel:r,methodValue:l,transmitLevel:u,transmitValue:v.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},c)}}}(t[r]))}function ne(e,t,r,s){e._serialize&&S(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let a=i[0];const c={};s&&(c.time=s),c.level=v.levels.values[t];let d=(e._childLevel|0)+1;if(d<1&&(d=1),a!==null&&typeof a=="object"){for(;d--&&typeof i[0]=="object";)Object.assign(c,i.shift());a=i.length?N(i.shift(),i):void 0}else typeof a=="string"&&(a=N(i.shift(),i));return a!==void 0&&(c.msg=a),c}function S(e,t,r,s){for(const i in e)if(s&&e[i]instanceof Error)e[i]=v.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i]))for(const a in e[i])t&&t.indexOf(a)>-1&&a in r&&(e[i][a]=r[a](e[i][a]))}function m(e,t,r){return function(){const s=new Array(1+arguments.length);s[0]=t;for(var i=1;i<s.length;i++)s[i]=arguments[i-1];return e[r].apply(this,s)}}function se(e,t,r){const s=t.send,i=t.ts,a=t.methodLevel,c=t.methodValue,d=t.val,n=e._logEvent.bindings;S(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(u){return n.indexOf(u)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=c,s(a,e._logEvent,d),e._logEvent=A(n)}function A(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function ie(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)t[r]===void 0&&(t[r]=e[r]);return t}function oe(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?P:x}function E(){return{}}function B(e){return e}function p(){}function P(){return!1}function x(){return Date.now()}function le(){return Math.round(Date.now()/1e3)}function ae(){return new Date(Date.now()).toISOString()}function ue(){function e(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}const V={level:"info"},w="custom_context",C=1e3*1024;class ce{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class D{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const r=new ce(t);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let r=this.head;for(;r!==null;)t.push(r.value),r=r.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const r=t.value;return t=t.next,{done:!1,value:r}}}}}const fe=e=>JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString()+"n":r);function M(e){return typeof e=="string"?e:fe(e)||""}class ${constructor(t,r=C){this.level=t??"error",this.levelValue=b.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new D(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,r){r===b.levels.values.error?console.error(t):r===b.levels.values.warn?console.warn(t):r===b.levels.values.debug?console.debug(t):r===b.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(M({timestamp:new Date().toISOString(),log:t}));const r=typeof t=="string"?JSON.parse(t).level:t.level;r>=this.levelValue&&this.forwardToConsole(t,r)}getLogs(){return this.logs}clearLogs(){this.logs=new D(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const r=this.getLogArray();return r.push(M({extraMetadata:t})),new Blob(r,{type:"application/json"})}}class he{constructor(t,r=C){this.baseChunkLogger=new $(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const r=URL.createObjectURL(this.logsToBlob(t)),s=document.createElement("a");s.href=r,s.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}class ge{constructor(t,r=C){this.baseChunkLogger=new $(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var de=Object.defineProperty,ve=Object.defineProperties,be=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,U=(e,t,r)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))Le.call(t,r)&&U(e,r,t[r]);if(G)for(var r of G(t))ye.call(t,r)&&U(e,r,t[r]);return e},k=(e,t)=>ve(e,be(t));function me(e){return k(T({},e),{level:e?.level||V.level})}function F(e,t=w){return e[t]||""}function R(e,t,r=w){return e[r]=t,e}function X(e,t=w){let r="";return typeof e.bindings>"u"?r=F(e,t):r=e.bindings().context||"",r}function Y(e,t,r=w){const s=X(e,r);return s.trim()?`${s}/${t}`:t}function we(e,t,r=w){const s=Y(e,t,r),i=e.child({context:s});return R(i,s,r)}function Z(e){var t,r;const s=new he((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace",browser:k(T({},(r=e.opts)==null?void 0:r.browser),{write:i=>s.write(i)})})),chunkLoggerController:s}}function q(e){var t;const r=new ge((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace"})),chunkLoggerController:r}}function Oe(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Z(e):q(e)}g.MAX_LOG_SIZE_IN_BYTES_DEFAULT=C,g.PINO_CUSTOM_CONTEXT_KEY=w,g.PINO_LOGGER_DEFAULTS=V,g.formatChildLoggerContext=Y,g.generateChildLogger=we,g.generateClientLogger=Z,g.generatePlatformLogger=Oe,g.generateServerLogger=q,g.getBrowserLoggerContext=F,g.getDefaultLoggerOptions=me,g.getLoggerContext=X,g.pino=b,g.setBrowserLoggerContext=R,Object.defineProperty(g,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -1,8 +0,6 @@ | ||
/// <reference types="node" /> | ||
import { Writable } from "stream"; | ||
import type { LoggerOptions } from "pino"; | ||
export default class ServerChunkLogger extends Writable { | ||
import type { DestinationStream, LoggerOptions } from "pino"; | ||
export default class ServerChunkLogger implements DestinationStream { | ||
private baseChunkLogger; | ||
constructor(level: LoggerOptions["level"], MAX_LOG_SIZE_IN_BYTES?: number); | ||
_write(chunk: any, _encoding: string, callback: (error?: Error | null) => void): void; | ||
write(chunk: any): void; | ||
getLogs(): import("./linkedList").default; | ||
@@ -9,0 +7,0 @@ clearLogs(): void; |
{ | ||
"name": "@walletconnect/logger", | ||
"description": "Logger Utils", | ||
"version": "2.1.1", | ||
"version": "2.1.2-98c4166", | ||
"author": "WalletConnect, Inc. <walletconnect.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
123483
183