Skip to content

Commit 68707ca

Browse files
committed
fix: more logging
1 parent 7ede9c6 commit 68707ca

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/endpoint/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default (server: Server, ipfsd: Factory, nodes: Record<string, Node>): vo
3535
path: '/spawn',
3636
handler: async (request) => {
3737
const options: any = request.payload ?? {}
38+
3839
try {
3940
const id = nanoid()
4041
nodes[id] = await ipfsd.spawn({

src/factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class DefaultFactory implements Factory<any> {
9393
await ctl.start(opts.start)
9494
}
9595

96+
log('spawned %s%s node', opts.remote ? 'remote ' : '', type)
9697
return ctl
9798
}
9899

src/kubo/daemon.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default class KuboDaemon implements KuboNode {
8989
async info (): Promise<KuboInfo> {
9090
const id = await this._api?.id()
9191

92-
return {
92+
const info = {
9393
version: await this.getVersion(),
9494
pid: this.subprocess?.pid,
9595
peerId: id?.id.toString(),
@@ -98,6 +98,10 @@ export default class KuboDaemon implements KuboNode {
9898
repo: this.repo,
9999
gateway: getGatewayAddress(this.repo)
100100
}
101+
102+
log('info %s %s %p %s', info.version, info.pid, info.peerId, info.repo)
103+
104+
return info
101105
}
102106

103107
/**
@@ -331,7 +335,10 @@ export default class KuboDaemon implements KuboNode {
331335
}
332336

333337
const { stdout } = out
338+
const version = stdout.trim()
339+
340+
log('getVersion version %s', version)
334341

335-
return stdout.trim()
342+
return version
336343
}
337344
}

src/kubo/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const checkForRunningApi = (repoPath = ''): string | undefined => {
2626
try {
2727
api = fs.readFileSync(path.join(repoPath, 'api'))
2828
} catch (err: any) {
29-
log('Unable to open api file')
29+
log('unable to open api file')
3030
}
3131

3232
return (api != null) ? api.toString() : undefined
@@ -42,7 +42,7 @@ export const getGatewayAddress = (repoPath = ''): string => {
4242
*/
4343
gatewayAddress = fs.readFileSync(path.join(repoPath, 'gateway'))?.toString()
4444
} catch (err: any) {
45-
log('Unable to open gateway file')
45+
log('unable to open gateway file')
4646
}
4747
return gatewayAddress
4848
}

0 commit comments

Comments
 (0)