Skip to content

Commit c1c8590

Browse files
committed
fix: logging
1 parent 68707ca commit c1c8590

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/kubo/client.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ export default class KuboClient implements KuboNode {
6262
}
6363

6464
async info (): Promise<KuboInfo> {
65+
log('info %s/info?%s', this.endpoint, new URLSearchParams({ id: this.id }).toString())
66+
6567
const response = await fetch(`${this.endpoint}/info?${new URLSearchParams({ id: this.id })}`, {
6668
method: 'GET'
6769
})
6870

71+
log('info %s/info?%s %d', this.endpoint, new URLSearchParams({ id: this.id }).toString(), response.status)
72+
6973
if (!response.ok) {
7074
throw new Error(`Error getting remote kubo info - ${await response.text()}`)
7175
}
@@ -87,6 +91,8 @@ export default class KuboClient implements KuboNode {
8791
})
8892
})
8993

94+
log('init %s/init?%s %d', this.endpoint, new URLSearchParams({ id: this.id }).toString(), response.status)
95+
9096
if (!response.ok) {
9197
throw new Error(`Error initializing remote kubo - ${await response.text()}`)
9298
}
@@ -128,6 +134,8 @@ export default class KuboClient implements KuboNode {
128134
})
129135
})
130136

137+
log('stop %s/stop?%s %d', this.endpoint, new URLSearchParams({ id: this.id }).toString(), response.status)
138+
131139
if (!response.ok) {
132140
throw new Error(`Error stopping remote kubo - ${await response.text()}`)
133141
}
@@ -144,6 +152,8 @@ export default class KuboClient implements KuboNode {
144152
method: 'POST'
145153
})
146154

155+
log('cleanup %s/cleanup?%s %d', this.endpoint, new URLSearchParams({ id: this.id }).toString(), response.status)
156+
147157
if (!response.ok) {
148158
throw new Error(`Error cleaning up remote kubo - ${await response.text()}`)
149159
}

0 commit comments

Comments
 (0)