@libp2p/logger 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +6 -0
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,MAAM;IACrB,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACtC,KAAK,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC/C,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,MAAM,CAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI5C"}
|
package/dist/src/index.js
CHANGED
|
@@ -13,6 +13,10 @@ debug.formatters.t = (v) => {
|
|
|
13
13
|
debug.formatters.p = (p) => {
|
|
14
14
|
return p.toString(base58btc);
|
|
15
15
|
};
|
|
16
|
+
// Add a formatter for stringifying CIDs
|
|
17
|
+
debug.formatters.c = (c) => {
|
|
18
|
+
return c.toString();
|
|
19
|
+
};
|
|
16
20
|
export function logger(name) {
|
|
17
21
|
return Object.assign(debug(name), {
|
|
18
22
|
error: debug(`${name}:error`)
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAIlD,oDAAoD;AACpD,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAa,EAAE,EAAE;IACrC,OAAO,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAChC,CAAC,CAAA;AAED,oDAAoD;AACpD,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAa,EAAE,EAAE;IACrC,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,4CAA4C;AAC5C,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE;IACjC,OAAO,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED,wCAAwC;AACxC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAM,EAAE,EAAE;IAC9B,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAA;AACrB,CAAC,CAAA;AAQD,MAAM,UAAU,MAAM,CAAE,IAAY;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QAChC,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC;KAC9B,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/logger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A logging component for use in js-libp2p components",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-logger#readme",
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import debug from 'debug'
|
|
|
2
2
|
import { base58btc } from 'multiformats/bases/base58'
|
|
3
3
|
import { base32 } from 'multiformats/bases/base32'
|
|
4
4
|
import type { PeerId } from '@libp2p/interfaces/peer-id'
|
|
5
|
+
import type { CID } from 'multiformats/cid'
|
|
5
6
|
|
|
6
7
|
// Add a formatter for converting to a base58 string
|
|
7
8
|
debug.formatters.b = (v: Uint8Array) => {
|
|
@@ -18,6 +19,11 @@ debug.formatters.p = (p: PeerId) => {
|
|
|
18
19
|
return p.toString(base58btc)
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
// Add a formatter for stringifying CIDs
|
|
23
|
+
debug.formatters.c = (c: CID) => {
|
|
24
|
+
return c.toString()
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
export interface Logger {
|
|
22
28
|
(formatter: any, ...args: any[]): void
|
|
23
29
|
error: (formatter: any, ...args: any[]) => void
|