Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/logger

Package Overview
Dependencies
Maintainers
6
Versions
562
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/logger - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1-05abd49f

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PLogger = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var Libp2PLogger=(()=>{var re=Object.create;var P=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var $=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),ae=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},T=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ne(r))!se.call(e,a)&&a!==t&&P(e,a,{get:()=>r[a],enumerable:!(o=te(r,a))||o.enumerable});return e};var ie=(e,r,t)=>(t=e!=null?re(oe(e)):{},T(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),ce=e=>T(P({},"__esModule",{value:!0}),e);var V=$((Pe,q)=>{var M=1e3,z=M*60,O=z*60,U=O*24,fe=U*7,ue=U*365.25;q.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return de(e);if(t==="number"&&isFinite(e))return r.long?pe(e):le(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function de(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*ue;case"weeks":case"week":case"w":return t*fe;case"days":case"day":case"d":return t*U;case"hours":case"hour":case"hrs":case"hr":case"h":return t*O;case"minutes":case"minute":case"mins":case"min":case"m":return t*z;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function le(e){var r=Math.abs(e);return r>=U?Math.round(e/U)+"d":r>=O?Math.round(e/O)+"h":r>=z?Math.round(e/z)+"m":r>=M?Math.round(e/M)+"s":e+"ms"}function pe(e){var r=Math.abs(e);return r>=U?j(e,r,U,"day"):r>=O?j(e,r,O,"hour"):r>=z?j(e,r,z,"minute"):r>=M?j(e,r,M,"second"):e+" ms"}function j(e,r,t,o){var a=r>=t*1.5;return Math.round(e/t)+" "+o+(a?"s":"")}});var X=$((je,G)=>{function he(e){t.debug=t,t.default=t,t.coerce=w,t.disable=p,t.enable=a,t.enabled=m,t.humanize=V(),t.destroy=N,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function r(n){let s=0;for(let f=0;f<n.length;f++)s=(s<<5)-s+n.charCodeAt(f),s|=0;return t.colors[Math.abs(s)%t.colors.length]}t.selectColor=r;function t(n){let s,f=null,S,i;function c(...d){if(!c.enabled)return;let l=c,C=Number(new Date),F=C-(s||C);l.diff=F,l.prev=s,l.curr=C,s=C,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let h=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(v,y)=>{if(v==="%%")return"%";h++;let A=t.formatters[y];if(typeof A=="function"){let k=d[h];v=A.call(l,k),d.splice(h,1),h--}return v}),t.formatArgs.call(l,d),(l.log||t.log).apply(l,d)}return c.namespace=n,c.useColors=t.useColors(),c.color=t.selectColor(n),c.extend=o,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(S!==t.namespaces&&(S=t.namespaces,i=t.enabled(n)),i),set:d=>{f=d}}),typeof t.init=="function"&&t.init(c),c}function o(n,s){let f=t(this.namespace+(typeof s>"u"?":":s)+n);return f.log=this.log,f}function a(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let s,f=(typeof n=="string"?n:"").split(/[\s,]+/),S=f.length;for(s=0;s<S;s++)f[s]&&(n=f[s].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function p(){let n=[...t.names.map(u),...t.skips.map(u).map(s=>"-"+s)].join(",");return t.enable(""),n}function m(n){if(n[n.length-1]==="*")return!0;let s,f;for(s=0,f=t.skips.length;s<f;s++)if(t.skips[s].test(n))return!1;for(s=0,f=t.names.length;s<f;s++)if(t.names[s].test(n))return!0;return!1}function u(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function w(n){return n instanceof Error?n.stack||n.message:n}function N(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}G.exports=he});var Z=$((x,I)=>{x.formatArgs=Ce;x.save=ge;x.load=me;x.useColors=be;x.storage=we();x.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();x.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function be(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ce(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+I.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,o=0;e[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(t++,a==="%c"&&(o=t))}),e.splice(o,0,r)}x.log=console.debug||console.log||(()=>{});function ge(e){try{e?x.storage.setItem("debug",e):x.storage.removeItem("debug")}catch{}}function me(){let e;try{e=x.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function we(){try{return localStorage}catch{}}I.exports=X()(x);var{formatters:ye}=I.exports;ye.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var Oe={};ae(Oe,{disable:()=>ke,enable:()=>Me,enabled:()=>ze,logger:()=>Se});var b=ie(Z(),1);function xe(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var a=0;a<e.length;a++){var p=e.charAt(a),m=p.charCodeAt(0);if(t[m]!==255)throw new TypeError(p+" is ambiguous");t[m]=a}var u=e.length,w=e.charAt(0),N=Math.log(u)/Math.log(256),n=Math.log(256)/Math.log(u);function s(i){if(i instanceof Uint8Array||(ArrayBuffer.isView(i)?i=new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Array.isArray(i)&&(i=Uint8Array.from(i))),!(i instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(i.length===0)return"";for(var c=0,d=0,l=0,C=i.length;l!==C&&i[l]===0;)l++,c++;for(var F=(C-l)*n+1>>>0,h=new Uint8Array(F);l!==C;){for(var E=i[l],v=0,y=F-1;(E!==0||v<d)&&y!==-1;y--,v++)E+=256*h[y]>>>0,h[y]=E%u>>>0,E=E/u>>>0;if(E!==0)throw new Error("Non-zero carry");d=v,l++}for(var A=F-d;A!==F&&h[A]===0;)A++;for(var k=w.repeat(c);A<F;++A)k+=e.charAt(h[A]);return k}function f(i){if(typeof i!="string")throw new TypeError("Expected String");if(i.length===0)return new Uint8Array;var c=0;if(i[c]!==" "){for(var d=0,l=0;i[c]===w;)d++,c++;for(var C=(i.length-c)*N+1>>>0,F=new Uint8Array(C);i[c];){var h=t[i.charCodeAt(c)];if(h===255)return;for(var E=0,v=C-1;(h!==0||E<l)&&v!==-1;v--,E++)h+=u*F[v]>>>0,F[v]=h%256>>>0,h=h/256>>>0;if(h!==0)throw new Error("Non-zero carry");l=E,c++}if(i[c]!==" "){for(var y=C-l;y!==C&&F[y]===0;)y++;for(var A=new Uint8Array(d+(C-y)),k=d;y!==C;)A[k++]=F[y++];return A}}}function S(i){var c=f(i);if(c)return c;throw new Error(`Non-${r} character`)}return{encode:s,decodeUnsafe:f,decode:S}}var Fe=xe,ve=Fe,K=ve;var $e=new Uint8Array(0);var Q=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var D=class{constructor(r,t,o){this.name=r,this.prefix=t,this.baseEncode=o}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},L=class{constructor(r,t,o){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=o}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return _(this,r)}},R=class{constructor(r){this.decoders=r}or(r){return _(this,r)}decode(r){let t=r[0],o=this.decoders[t];if(o)return o.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},_=(e,r)=>new R({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}}),B=class{constructor(r,t,o,a){this.name=r,this.prefix=t,this.baseEncode=o,this.baseDecode=a,this.encoder=new D(r,t,o),this.decoder=new L(r,t,a)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},W=({name:e,prefix:r,encode:t,decode:o})=>new B(e,r,t,o),J=({prefix:e,name:r,alphabet:t})=>{let{encode:o,decode:a}=K(t,r);return W({prefix:e,name:r,encode:o,decode:p=>Q(a(p))})},Ae=(e,r,t,o)=>{let a={};for(let n=0;n<r.length;++n)a[r[n]]=n;let p=e.length;for(;e[p-1]==="=";)--p;let m=new Uint8Array(p*t/8|0),u=0,w=0,N=0;for(let n=0;n<p;++n){let s=a[e[n]];if(s===void 0)throw new SyntaxError(`Non-${o} character`);w=w<<t|s,u+=t,u>=8&&(u-=8,m[N++]=255&w>>u)}if(u>=t||255&w<<8-u)throw new SyntaxError("Unexpected end of data");return m},Ee=(e,r,t)=>{let o=r[r.length-1]==="=",a=(1<<t)-1,p="",m=0,u=0;for(let w=0;w<e.length;++w)for(u=u<<8|e[w],m+=8;m>t;)m-=t,p+=r[a&u>>m];if(m&&(p+=r[a&u<<t-m]),o)for(;p.length*t&7;)p+="=";return p},g=({name:e,prefix:r,bitsPerChar:t,alphabet:o})=>W({prefix:r,name:e,encode(a){return Ee(a,o,t)},decode(a){return Ae(a,o,t,e)}});var Y=J({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Te=J({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var H=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ge=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Xe=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ze=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ke=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qe=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_e=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),We=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ye=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ee=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tr=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nr=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});b.default.formatters.b=e=>e==null?"undefined":Y.baseEncode(e);b.default.formatters.t=e=>e==null?"undefined":H.baseEncode(e);b.default.formatters.m=e=>e==null?"undefined":ee.baseEncode(e);b.default.formatters.p=e=>e==null?"undefined":e.toString();b.default.formatters.c=e=>e==null?"undefined":e.toString();b.default.formatters.k=e=>e==null?"undefined":e.toString();b.default.formatters.ma=e=>e==null?"undefined":e.toString();function Ue(e){let r=()=>{};return r.enabled=!1,r.color="",r.diff=0,r.log=()=>{},r.namespace=e,r.destroy=()=>!0,r.extend=()=>r,r}function Se(e){let r=Ue(`${e}:trace`);return b.default.enabled(`${e}:trace`)&&b.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(r=(0,b.default)(`${e}:trace`)),Object.assign((0,b.default)(e),{error:(0,b.default)(`${e}:error`),trace:r})}function ke(){b.default.disable()}function Me(e){b.default.enable(e)}function ze(e){return b.default.enabled(e)}return ce(Oe);})();
"use strict";var Libp2PLogger=(()=>{var re=Object.create;var P=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var $=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),ae=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},T=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ne(r))!se.call(e,a)&&a!==t&&P(e,a,{get:()=>r[a],enumerable:!(o=te(r,a))||o.enumerable});return e};var ie=(e,r,t)=>(t=e!=null?re(oe(e)):{},T(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),ce=e=>T(P({},"__esModule",{value:!0}),e);var V=$((Pe,q)=>{var M=1e3,z=M*60,O=z*60,U=O*24,fe=U*7,ue=U*365.25;q.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return de(e);if(t==="number"&&isFinite(e))return r.long?pe(e):le(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function de(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*ue;case"weeks":case"week":case"w":return t*fe;case"days":case"day":case"d":return t*U;case"hours":case"hour":case"hrs":case"hr":case"h":return t*O;case"minutes":case"minute":case"mins":case"min":case"m":return t*z;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function le(e){var r=Math.abs(e);return r>=U?Math.round(e/U)+"d":r>=O?Math.round(e/O)+"h":r>=z?Math.round(e/z)+"m":r>=M?Math.round(e/M)+"s":e+"ms"}function pe(e){var r=Math.abs(e);return r>=U?j(e,r,U,"day"):r>=O?j(e,r,O,"hour"):r>=z?j(e,r,z,"minute"):r>=M?j(e,r,M,"second"):e+" ms"}function j(e,r,t,o){var a=r>=t*1.5;return Math.round(e/t)+" "+o+(a?"s":"")}});var X=$((je,G)=>{function he(e){t.debug=t,t.default=t,t.coerce=w,t.disable=p,t.enable=a,t.enabled=m,t.humanize=V(),t.destroy=N,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function r(n){let s=0;for(let f=0;f<n.length;f++)s=(s<<5)-s+n.charCodeAt(f),s|=0;return t.colors[Math.abs(s)%t.colors.length]}t.selectColor=r;function t(n){let s,f=null,S,i;function c(...d){if(!c.enabled)return;let l=c,C=Number(new Date),F=C-(s||C);l.diff=F,l.prev=s,l.curr=C,s=C,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let h=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(v,y)=>{if(v==="%%")return"%";h++;let A=t.formatters[y];if(typeof A=="function"){let k=d[h];v=A.call(l,k),d.splice(h,1),h--}return v}),t.formatArgs.call(l,d),(l.log||t.log).apply(l,d)}return c.namespace=n,c.useColors=t.useColors(),c.color=t.selectColor(n),c.extend=o,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(S!==t.namespaces&&(S=t.namespaces,i=t.enabled(n)),i),set:d=>{f=d}}),typeof t.init=="function"&&t.init(c),c}function o(n,s){let f=t(this.namespace+(typeof s>"u"?":":s)+n);return f.log=this.log,f}function a(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let s,f=(typeof n=="string"?n:"").split(/[\s,]+/),S=f.length;for(s=0;s<S;s++)f[s]&&(n=f[s].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function p(){let n=[...t.names.map(u),...t.skips.map(u).map(s=>"-"+s)].join(",");return t.enable(""),n}function m(n){if(n[n.length-1]==="*")return!0;let s,f;for(s=0,f=t.skips.length;s<f;s++)if(t.skips[s].test(n))return!1;for(s=0,f=t.names.length;s<f;s++)if(t.names[s].test(n))return!0;return!1}function u(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function w(n){return n instanceof Error?n.stack||n.message:n}function N(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}G.exports=he});var Z=$((x,I)=>{x.formatArgs=Ce;x.save=ge;x.load=me;x.useColors=be;x.storage=we();x.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();x.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function be(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ce(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+I.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,o=0;e[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(t++,a==="%c"&&(o=t))}),e.splice(o,0,r)}x.log=console.debug||console.log||(()=>{});function ge(e){try{e?x.storage.setItem("debug",e):x.storage.removeItem("debug")}catch{}}function me(){let e;try{e=x.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function we(){try{return localStorage}catch{}}I.exports=X()(x);var{formatters:ye}=I.exports;ye.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var Oe={};ae(Oe,{disable:()=>ke,enable:()=>Me,enabled:()=>ze,logger:()=>Se});var b=ie(Z(),1);function xe(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var a=0;a<e.length;a++){var p=e.charAt(a),m=p.charCodeAt(0);if(t[m]!==255)throw new TypeError(p+" is ambiguous");t[m]=a}var u=e.length,w=e.charAt(0),N=Math.log(u)/Math.log(256),n=Math.log(256)/Math.log(u);function s(i){if(i instanceof Uint8Array||(ArrayBuffer.isView(i)?i=new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Array.isArray(i)&&(i=Uint8Array.from(i))),!(i instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(i.length===0)return"";for(var c=0,d=0,l=0,C=i.length;l!==C&&i[l]===0;)l++,c++;for(var F=(C-l)*n+1>>>0,h=new Uint8Array(F);l!==C;){for(var E=i[l],v=0,y=F-1;(E!==0||v<d)&&y!==-1;y--,v++)E+=256*h[y]>>>0,h[y]=E%u>>>0,E=E/u>>>0;if(E!==0)throw new Error("Non-zero carry");d=v,l++}for(var A=F-d;A!==F&&h[A]===0;)A++;for(var k=w.repeat(c);A<F;++A)k+=e.charAt(h[A]);return k}function f(i){if(typeof i!="string")throw new TypeError("Expected String");if(i.length===0)return new Uint8Array;var c=0;if(i[c]!==" "){for(var d=0,l=0;i[c]===w;)d++,c++;for(var C=(i.length-c)*N+1>>>0,F=new Uint8Array(C);i[c];){var h=t[i.charCodeAt(c)];if(h===255)return;for(var E=0,v=C-1;(h!==0||E<l)&&v!==-1;v--,E++)h+=u*F[v]>>>0,F[v]=h%256>>>0,h=h/256>>>0;if(h!==0)throw new Error("Non-zero carry");l=E,c++}if(i[c]!==" "){for(var y=C-l;y!==C&&F[y]===0;)y++;for(var A=new Uint8Array(d+(C-y)),k=d;y!==C;)A[k++]=F[y++];return A}}}function S(i){var c=f(i);if(c)return c;throw new Error(`Non-${r} character`)}return{encode:s,decodeUnsafe:f,decode:S}}var Fe=xe,ve=Fe,K=ve;var $e=new Uint8Array(0);var Q=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var D=class{constructor(r,t,o){this.name=r,this.prefix=t,this.baseEncode=o}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},L=class{constructor(r,t,o){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=o}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return _(this,r)}},R=class{constructor(r){this.decoders=r}or(r){return _(this,r)}decode(r){let t=r[0],o=this.decoders[t];if(o)return o.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},_=(e,r)=>new R({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}}),B=class{constructor(r,t,o,a){this.name=r,this.prefix=t,this.baseEncode=o,this.baseDecode=a,this.encoder=new D(r,t,o),this.decoder=new L(r,t,a)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},W=({name:e,prefix:r,encode:t,decode:o})=>new B(e,r,t,o),J=({prefix:e,name:r,alphabet:t})=>{let{encode:o,decode:a}=K(t,r);return W({prefix:e,name:r,encode:o,decode:p=>Q(a(p))})},Ae=(e,r,t,o)=>{let a={};for(let n=0;n<r.length;++n)a[r[n]]=n;let p=e.length;for(;e[p-1]==="=";)--p;let m=new Uint8Array(p*t/8|0),u=0,w=0,N=0;for(let n=0;n<p;++n){let s=a[e[n]];if(s===void 0)throw new SyntaxError(`Non-${o} character`);w=w<<t|s,u+=t,u>=8&&(u-=8,m[N++]=255&w>>u)}if(u>=t||255&w<<8-u)throw new SyntaxError("Unexpected end of data");return m},Ee=(e,r,t)=>{let o=r[r.length-1]==="=",a=(1<<t)-1,p="",m=0,u=0;for(let w=0;w<e.length;++w)for(u=u<<8|e[w],m+=8;m>t;)m-=t,p+=r[a&u>>m];if(m&&(p+=r[a&u<<t-m]),o)for(;p.length*t&7;)p+="=";return p},g=({name:e,prefix:r,bitsPerChar:t,alphabet:o})=>W({prefix:r,name:e,encode(a){return Ee(a,o,t)},decode(a){return Ae(a,o,t,e)}});var Y=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Te=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qe=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ve=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ge=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xe=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ze=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ke=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qe=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var H=J({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ye=J({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ee=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tr=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nr=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});b.default.formatters.b=e=>e==null?"undefined":H.baseEncode(e);b.default.formatters.t=e=>e==null?"undefined":Y.baseEncode(e);b.default.formatters.m=e=>e==null?"undefined":ee.baseEncode(e);b.default.formatters.p=e=>e==null?"undefined":e.toString();b.default.formatters.c=e=>e==null?"undefined":e.toString();b.default.formatters.k=e=>e==null?"undefined":e.toString();b.default.formatters.a=e=>e==null?"undefined":e.toString();function Ue(e){let r=()=>{};return r.enabled=!1,r.color="",r.diff=0,r.log=()=>{},r.namespace=e,r.destroy=()=>!0,r.extend=()=>r,r}function Se(e){let r=Ue(`${e}:trace`);return b.default.enabled(`${e}:trace`)&&b.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(r=(0,b.default)(`${e}:trace`)),Object.assign((0,b.default)(e),{error:(0,b.default)(`${e}:error`),trace:r})}function ke(){b.default.disable()}function Me(e){b.default.enable(e)}function ze(e){return b.default.enabled(e)}return ce(Oe);})();
return Libp2PLogger}));
import debug from 'debug';
import { base32 } from 'multiformats/bases/base32';
import { base58btc } from 'multiformats/bases/base58';
import { base32 } from 'multiformats/bases/base32';
import { base64 } from 'multiformats/bases/base64';

@@ -30,3 +30,3 @@ // Add a formatter for converting to a base58 string

// Add a formatter for stringifying Multiaddrs
debug.formatters.ma = (v) => {
debug.formatters.a = (v) => {
return v == null ? 'undefined' : v.toString();

@@ -33,0 +33,0 @@ };

{
"name": "@libp2p/logger",
"version": "2.1.0",
"version": "2.1.1-05abd49f",
"description": "A logging component for use in js-libp2p modules",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/libp2p/js-libp2p-logger#readme",
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/logger#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/libp2p/js-libp2p-logger.git"
"url": "git+https://github.com/libp2p/js-libp2p.git"
},
"bugs": {
"url": "https://github.com/libp2p/js-libp2p-logger/issues"
"url": "https://github.com/libp2p/js-libp2p/issues"
},

@@ -17,6 +17,2 @@ "keywords": [

],
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"type": "module",

@@ -42,87 +38,2 @@ "types": "./dist/src/index.d.ts",

},
"release": {
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"scripts": {

@@ -139,19 +50,21 @@ "clean": "aegir clean",

"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "aegir release",
"docs": "aegir docs"
"test:electron-main": "aegir test -t electron-main"
},
"dependencies": {
"@libp2p/interface-peer-id": "^2.0.2",
"@libp2p/interface": "0.0.1-05abd49f",
"@multiformats/multiaddr": "^12.1.3",
"debug": "^4.3.4",
"interface-datastore": "^8.2.0",
"multiformats": "^11.0.2"
"multiformats": "^12.0.1"
},
"devDependencies": {
"@libp2p/peer-id": "^2.0.3",
"@libp2p/peer-id": "2.0.3-05abd49f",
"@types/debug": "^4.1.7",
"aegir": "^38.1.7",
"aegir": "^39.0.10",
"sinon": "^15.1.2",
"uint8arrays": "^4.0.3"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

@@ -5,4 +5,4 @@ # @libp2p/logger <!-- omit in toc -->

[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-logger.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-logger)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-logger/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-logger/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster)

@@ -67,3 +67,3 @@ > A logging component for use in js-libp2p modules

- <https://libp2p.github.io/js-libp2p-logger>
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_logger.html>

@@ -70,0 +70,0 @@ ## License

import debug from 'debug'
import { base32 } from 'multiformats/bases/base32'
import { base58btc } from 'multiformats/bases/base58'
import { base32 } from 'multiformats/bases/base32'
import { base64 } from 'multiformats/bases/base64'
import type { PeerId } from '@libp2p/interface-peer-id'
import type { CID } from 'multiformats/cid'
import type { PeerId } from '@libp2p/interface/peer-id'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Key } from 'interface-datastore'
import type { CID } from 'multiformats/cid'

@@ -41,3 +41,3 @@ // Add a formatter for converting to a base58 string

// Add a formatter for stringifying Multiaddrs
debug.formatters.ma = (v?: Multiaddr): string => {
debug.formatters.a = (v?: Multiaddr): string => {
return v == null ? 'undefined' : v.toString()

@@ -44,0 +44,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc