Skip to content

Commit 9757d20

Browse files
committed
Store logs in separate json files for each device
1 parent 8bb3704 commit 9757d20

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/cli/esim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = ({ commandProcessor, root }) => {
1212
description: 'Provide the input json file path'
1313
},
1414
'output': {
15-
description: 'Provide the output json file path'
15+
description: 'Provide the output folder path'
1616
},
1717
'binary': {
1818
description: 'Provide the path to the binaries'

src/cmd/esim.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = class ESimCommands extends CLICommandBase {
2626
this.lpa = null;
2727
this.inputJson = null;
2828
this.inputJsonData = null;
29-
this.outputJson = null;
29+
this.outputFolder = null;
3030
this.downloadedProfiles = [];
3131
this.binaries = null;
3232
this.verbose = false;
@@ -47,7 +47,8 @@ module.exports = class ESimCommands extends CLICommandBase {
4747
const device = devices[0];
4848
const resp = await this.doProvision(device);
4949
await this._changeLed(device, resp.success ? PROVISIONING_SUCCESS : PROVISIONING_FAILURE);
50-
this._addToJson(this.outputJson, resp);
50+
const outputJsonForDevice = path.join(this.outputFolder, `${device.deviceId}.json`);
51+
this._addToJson(outputJsonForDevice, resp);
5152
}
5253

5354
async bulkProvisionCommand(args) {
@@ -61,9 +62,10 @@ module.exports = class ESimCommands extends CLICommandBase {
6162
const deviceId = device.deviceId;
6263
provisionedDevices.add(deviceId);
6364
console.log(`Device ${deviceId} connected`);
64-
const resp = await this.doProvision(device, { verbose: true });
65+
const outputJsonForDevice = path.join(this.outputFolder, `${deviceId}.json`);
66+
const resp = await this.doProvision(device, { verbose: false });
6567
await this._changeLed(device, resp.success ? PROVISIONING_SUCCESS : PROVISIONING_FAILURE);
66-
this._addToJson(this.outputJson, resp);
68+
this._addToJson(outputJsonForDevice, resp);
6769
}
6870
}
6971
}, 1000);
@@ -232,7 +234,7 @@ module.exports = class ESimCommands extends CLICommandBase {
232234
const input = fs.readFileSync(this.inputJson);
233235
this.inputJsonData = JSON.parse(input);
234236

235-
this.outputJson = args.output;
237+
this.outputFolder = args.output;
236238
this.lpa = args.lpa;
237239
this.binaries = args.binary;
238240
}

0 commit comments

Comments
 (0)