This repository was archived by the owner on Jul 21, 2023. It is now read-only.
Commit f80d1ea
authored
fix: human readable peer ids in console.log (#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: []
}
```1 parent f5bbf38 commit f80d1ea
1 file changed
+35
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | | - | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
114 | 132 | | |
115 | 133 | | |
116 | 134 | | |
| |||
146 | 164 | | |
147 | 165 | | |
148 | 166 | | |
149 | | - | |
150 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
151 | 181 | | |
152 | 182 | | |
153 | 183 | | |
| |||
0 commit comments