in datajets/file-datajet.ts [33:52]
transmitBatch: async (batch: Array<ILogData>) => {
if (!logStream) {
logStream = fs.createWriteStream(file, { flags: 'a' }); /* 27.48 seconds - 27.862 */
}
/* does stringify take too long? */
const len = batch.length;
for (let i = 0; i < len; ++i) {
const log = batch[i];
/* const str = `${log[config.key] ?? "null"}\n`; */
/* log[config.key] ?? "null" */
logStream.write((config.logKey) ?
`${log[config.logKey] ?? "null"}\n` : /* Elapsed time: 27.48 seconds - 27.41 seconds single string */
((typeof log === "object") ?
`${JSON.stringify(log)}\n` :
log ?? "null"));
// fs.writeFileSync(file, , { flag: 'a+' });
}
return true;
}