Skip to content

Commit

Permalink
feat: added some more logging and include the timestamp.
Browse files Browse the repository at this point in the history
  • Loading branch information
lart2150 committed Jun 10, 2024
1 parent 0004b88 commit 5d5a4a2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type ScriptResult = {
}
}

const log = (message: String) => {
console.log(new Date().toLocaleTimeString(), message);
}

const mkdir = async (path: string): Promise<void> => {
try {
Expand Down Expand Up @@ -58,7 +61,7 @@ for (const file of files) {

const layout = client.layout('SaXMLDeliveryExecutionContext');

console.log('calling FM script');
log('calling FM script');

const executeScriptResult = await layout.executeScript('RunSaXMLDelivery');

Expand Down Expand Up @@ -87,7 +90,7 @@ for (const file of files) {
process.exit(20);
}

console.log('Starting download of container field');
log('Starting download of container field');

const containerResponse = await client.requestContainer(containerUrl);

Expand All @@ -96,10 +99,13 @@ for (const file of files) {
transcode(containerResponse.buffer, 'utf-16le', 'utf8')
);

log('finished downloading container field');

const clearXml : Partial<FieldData> = {};
clearXml[field] = '';

await layout.update(Number(records.data[0].recordId), clearXml);
await client.clearToken();
log('finished');
}

0 comments on commit 5d5a4a2

Please sign in to comment.