Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: human readable peer ids in console.log (libp2p#36)
Add [inspect](https://nodejs.org/api/util.html#utilinspectcustom) method so when printing PeerIds in the console they are readble. Old: ``` { peer: RSAPeerIdImpl [PeerId(QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN)] { type: 'RSA', multihash: Digest { code: 18, size: 32, digest: [Uint8Array], bytes: [Uint8Array] }, privateKey: undefined, publicKey: <Buffer 08 00 12 a6 02 30 82 01 22 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 01 0a 02 82 01 01 00 d7 ab 01 ee 41 35 d7 ce cd 99 63 5b ... 249 more bytes> }, name: 'DIALING_PEER', type: 7 } { to: RSAPeerIdImpl [PeerId(QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN)] { type: 'RSA', multihash: Digest { code: 18, size: 32, digest: [Uint8Array], bytes: [Uint8Array] }, privateKey: undefined, publicKey: <Buffer 08 00 12 a6 02 30 82 01 22 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 01 0a 02 82 01 01 00 d7 ab 01 ee 41 35 d7 ce cd 99 63 5b ... 249 more bytes> }, type: 0, name: 'SENDING_QUERY', messageName: 'ADD_PROVIDER', messageType: 2 } { from: RSAPeerIdImpl [PeerId(QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN)] { type: 'RSA', multihash: Digest { code: 18, size: 32, digest: [Uint8Array], bytes: [Uint8Array] }, privateKey: undefined, publicKey: <Buffer 08 00 12 a6 02 30 82 01 22 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 01 0a 02 82 01 01 00 d7 ab 01 ee 41 35 d7 ce cd 99 63 5b ... 249 more bytes> }, messageType: 'ADD_PROVIDER', name: 'PEER_RESPONSE', type: 1, messageName: 'ADD_PROVIDER', closer: [], providers: [] } ``` New: ``` { peer: PeerId(QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt), name: 'DIALING_PEER', type: 7 } { to: PeerId(QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt), type: 0, name: 'SENDING_QUERY', messageName: 'ADD_PROVIDER', messageType: 2 } { from: PeerId(QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt), messageType: 'ADD_PROVIDER', name: 'PEER_RESPONSE', type: 1, messageName: 'ADD_PROVIDER', closer: [], providers: [] } ```
- Loading branch information