@walletconnect/logger
Advanced tools
Comparing version 2.1.0-cab1ccc to 2.1.0-e8db983
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("pino"),w=require("stream");function C(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var u=C(n);const h={level:"info"},s="custom_context",i=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 c{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 d{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 c(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(JSON.stringify({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 c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.append(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class S{constructor(e,t=i){this.baseChunkLogger=new d(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=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B extends w.Writable{constructor(e,t=i){super({objectMode:!0}),this.baseChunkLogger=new d(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 x=Object.defineProperty,T=Object.defineProperties,m=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,E=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,g=(r,e)=>{for(var t in e||(e={}))E.call(e,t)&&f(r,t,e[t]);if(L)for(var t of L(e))z.call(e,t)&&f(r,t,e[t]);return r},a=(r,e)=>T(r,m(e));function A(r){return a(g({},r),{level:r?.level||h.level})}function v(r,e=s){return r[e]||""}function p(r,e,t=s){return r[t]=e,r}function b(r,e=s){let t="";return typeof r.bindings>"u"?t=v(r,e):t=r.bindings().context||"",t}function y(r,e,t=s){const o=b(r,t);return o.trim()?`${o}/${e}`:e}function k(r,e,t=s){const o=y(r,e,t),l=r.child({context:o});return p(l,o,t)}function O(r){var e,t;const o=new S((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 _(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(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"?_(r):O(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=h,exports.formatChildLoggerContext=y,exports.generateChildLogger=k,exports.generateClientLogger=O,exports.generateServerLogger=_,exports.getBrowserLoggerContext=v,exports.getDefaultLoggerOptions=A,exports.getLoggerContext=b,exports.getPlatformLogger=N,exports.setBrowserLoggerContext=p; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("pino"),w=require("stream");function C(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var u=C(n);const h={level:"info"},s="custom_context",i=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 c{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 d{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 c(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(JSON.stringify({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 c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.append(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class S{constructor(e,t=i){this.baseChunkLogger=new d(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=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B extends w.Writable{constructor(e,t=i){super({objectMode:!0}),this.baseChunkLogger=new d(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 x=Object.defineProperty,T=Object.defineProperties,m=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,E=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,g=(r,e)=>{for(var t in e||(e={}))E.call(e,t)&&f(r,t,e[t]);if(L)for(var t of L(e))z.call(e,t)&&f(r,t,e[t]);return r},a=(r,e)=>T(r,m(e));function A(r){return a(g({},r),{level:r?.level||h.level})}function v(r,e=s){return r[e]||""}function p(r,e,t=s){return r[t]=e,r}function b(r,e=s){let t="";return typeof r.bindings>"u"?t=v(r,e):t=r.bindings().context||"",t}function y(r,e,t=s){const o=b(r,t);return o.trim()?`${o}/${e}`:e}function k(r,e,t=s){const o=y(r,e,t),l=r.child({context:o});return p(l,o,t)}function O(r){var e,t;const o=new S((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 _(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(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"?_(r):O(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=h,exports.formatChildLoggerContext=y,exports.generateChildLogger=k,exports.generateClientLogger=O,exports.generatePlatformLogger=N,exports.generateServerLogger=_,exports.getBrowserLoggerContext=v,exports.getDefaultLoggerOptions=A,exports.getLoggerContext=b,exports.setBrowserLoggerContext=p; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import h,{levels as i}from"pino";import{default as M}from"pino";import{Writable as C}from"stream";const u={level:"info"},n="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 c{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 d{constructor(e,t=l){this.level=e??"error",this.levelValue=i.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new c(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(JSON.stringify({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 c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.append(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class m{constructor(e,t=l){this.baseChunkLogger=new d(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=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B extends C{constructor(e,t=l){super({objectMode:!0}),this.baseChunkLogger=new d(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 x=Object.defineProperty,S=Object.defineProperties,_=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,p=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))T.call(e,t)&&p(r,t,e[t]);if(L)for(var t of L(e))z.call(e,t)&&p(r,t,e[t]);return r},a=(r,e)=>S(r,_(e));function k(r){return a(g({},r),{level:r?.level||u.level})}function f(r,e=n){return r[e]||""}function b(r,e,t=n){return r[t]=e,r}function v(r,e=n){let t="";return typeof r.bindings>"u"?t=f(r,e):t=r.bindings().context||"",t}function y(r,e,t=n){const o=v(r,t);return o.trim()?`${o}/${e}`:e}function E(r,e,t=n){const o=y(r,e,t),s=r.child({context:o});return b(s,o,t)}function w(r){var e,t;const o=new m((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 O(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(a(g({},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"?O(r):w(r)}export{l as MAX_LOG_SIZE_IN_BYTES_DEFAULT,n as PINO_CUSTOM_CONTEXT_KEY,u as PINO_LOGGER_DEFAULTS,y as formatChildLoggerContext,E as generateChildLogger,w as generateClientLogger,O as generateServerLogger,f as getBrowserLoggerContext,k as getDefaultLoggerOptions,v as getLoggerContext,A as getPlatformLogger,M as pino,b as setBrowserLoggerContext}; | ||
import h,{levels as i}from"pino";import{default as M}from"pino";import{Writable as C}from"stream";const u={level:"info"},n="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 c{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 d{constructor(e,t=l){this.level=e??"error",this.levelValue=i.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new c(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(JSON.stringify({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 c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.append(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class m{constructor(e,t=l){this.baseChunkLogger=new d(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=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B extends C{constructor(e,t=l){super({objectMode:!0}),this.baseChunkLogger=new d(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 x=Object.defineProperty,S=Object.defineProperties,_=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,p=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))T.call(e,t)&&p(r,t,e[t]);if(L)for(var t of L(e))z.call(e,t)&&p(r,t,e[t]);return r},a=(r,e)=>S(r,_(e));function k(r){return a(g({},r),{level:r?.level||u.level})}function f(r,e=n){return r[e]||""}function b(r,e,t=n){return r[t]=e,r}function v(r,e=n){let t="";return typeof r.bindings>"u"?t=f(r,e):t=r.bindings().context||"",t}function y(r,e,t=n){const o=v(r,t);return o.trim()?`${o}/${e}`:e}function E(r,e,t=n){const o=y(r,e,t),s=r.child({context:o});return b(s,o,t)}function w(r){var e,t;const o=new m((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 O(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(a(g({},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"?O(r):w(r)}export{l as MAX_LOG_SIZE_IN_BYTES_DEFAULT,n as PINO_CUSTOM_CONTEXT_KEY,u as PINO_LOGGER_DEFAULTS,y as formatChildLoggerContext,E as generateChildLogger,w as generateClientLogger,A as generatePlatformLogger,O as generateServerLogger,f as getBrowserLoggerContext,k as getDefaultLoggerOptions,v as getLoggerContext,M 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 K(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var W=Q;function Q(e,t,r){var s=r&&r.stringify||K,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=W;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,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 Z=j.serializers;if(i&&Z){var I=Object.assign({},s,Z),J=e.browser.serialize===!0?Object.keys(I):i;delete h.serializers,S([h],J,I,this._stdErrSerialize)}function H(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=J),t&&(this._logEvent=A([].concat(m._logEvent.bindings,h)))}return H.prototype=this,new H(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:x,epochTime:P,unixTime:le,isoTime:ae});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,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 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 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?x:P}function E(){return{}}function B(e){return e}function p(){}function x(){return!1}function P(){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 M{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}}}}}class D{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(JSON.stringify({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){return this.logs.append(JSON.stringify({extraMetadata:t})),new Blob(this.getLogArray(),{type:"application/json"})}}class fe{constructor(t,r=C){this.baseChunkLogger=new D(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=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}class he extends O.Writable{constructor(t,r=C){super({objectMode:!0}),this.baseChunkLogger=new D(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 ge=Object.defineProperty,de=Object.defineProperties,ve=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,U=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))be.call(t,r)&&U(e,r,t[r]);if(G)for(var r of G(t))me.call(t,r)&&U(e,r,t[r]);return e},k=(e,t)=>de(e,ve(t));function Le(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 $(e,t=w){let r="";return typeof e.bindings>"u"?r=F(e,t):r=e.bindings().context||"",r}function X(e,t,r=w){const s=$(e,r);return s.trim()?`${s}/${t}`:t}function ye(e,t,r=w){const s=X(e,t,r),i=e.child({context:s});return R(i,s,r)}function Y(e){var t,r;const s=new fe((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 he((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace"})),chunkLoggerController:r}}function we(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?q(e):Y(e)}g.MAX_LOG_SIZE_IN_BYTES_DEFAULT=C,g.PINO_CUSTOM_CONTEXT_KEY=w,g.PINO_LOGGER_DEFAULTS=V,g.formatChildLoggerContext=X,g.generateChildLogger=ye,g.generateClientLogger=Y,g.generateServerLogger=q,g.getBrowserLoggerContext=F,g.getDefaultLoggerOptions=Le,g.getLoggerContext=$,g.getPlatformLogger=we,g.pino=b,g.setBrowserLoggerContext=R,Object.defineProperty(g,"__esModule",{value:!0})}); | ||
(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 K(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var W=Q;function Q(e,t,r){var s=r&&r.stringify||K,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=W;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,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 Z=j.serializers;if(i&&Z){var I=Object.assign({},s,Z),J=e.browser.serialize===!0?Object.keys(I):i;delete h.serializers,S([h],J,I,this._stdErrSerialize)}function H(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=J),t&&(this._logEvent=A([].concat(m._logEvent.bindings,h)))}return H.prototype=this,new H(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:x,epochTime:P,unixTime:le,isoTime:ae});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,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 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 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?x:P}function E(){return{}}function B(e){return e}function p(){}function x(){return!1}function P(){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 M{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}}}}}class D{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(JSON.stringify({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){return this.logs.append(JSON.stringify({extraMetadata:t})),new Blob(this.getLogArray(),{type:"application/json"})}}class fe{constructor(t,r=C){this.baseChunkLogger=new D(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=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}class he extends O.Writable{constructor(t,r=C){super({objectMode:!0}),this.baseChunkLogger=new D(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 ge=Object.defineProperty,de=Object.defineProperties,ve=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,U=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))be.call(t,r)&&U(e,r,t[r]);if(G)for(var r of G(t))me.call(t,r)&&U(e,r,t[r]);return e},k=(e,t)=>de(e,ve(t));function Le(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 $(e,t=w){let r="";return typeof e.bindings>"u"?r=F(e,t):r=e.bindings().context||"",r}function X(e,t,r=w){const s=$(e,r);return s.trim()?`${s}/${t}`:t}function ye(e,t,r=w){const s=X(e,t,r),i=e.child({context:s});return R(i,s,r)}function Y(e){var t,r;const s=new fe((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 he((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace"})),chunkLoggerController:r}}function we(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?q(e):Y(e)}g.MAX_LOG_SIZE_IN_BYTES_DEFAULT=C,g.PINO_CUSTOM_CONTEXT_KEY=w,g.PINO_LOGGER_DEFAULTS=V,g.formatChildLoggerContext=X,g.generateChildLogger=ye,g.generateClientLogger=Y,g.generatePlatformLogger=we,g.generateServerLogger=q,g.getBrowserLoggerContext=F,g.getDefaultLoggerOptions=Le,g.getLoggerContext=$,g.pino=b,g.setBrowserLoggerContext=R,Object.defineProperty(g,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -31,6 +31,6 @@ import { Logger, LoggerOptions } from "pino"; | ||
}; | ||
export declare function getPlatformLogger(params: { | ||
export declare function generatePlatformLogger(params: { | ||
maxSizeInBytes?: number; | ||
opts?: LoggerOptions; | ||
loggerOverride: string | Logger<any>; | ||
loggerOverride?: string | Logger<any>; | ||
}): { | ||
@@ -37,0 +37,0 @@ logger: Logger<any>; |
{ | ||
"name": "@walletconnect/logger", | ||
"description": "Logger Utils", | ||
"version": "2.1.0-cab1ccc", | ||
"version": "2.1.0-e8db983", | ||
"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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
123186
186
0