Skip to content

Commit 9adacd5

Browse files
committed
get date before yielding the event loop
1 parent fbfe012 commit 9adacd5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/logger.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export class JSONLogAttachment extends LogAttachment {
9292
return Promise.resolve(serialize(m))
9393
})
9494

95+
const date = new Date().toISOString()
9596
Promise.all(messageParts)
9697
.then(parts => {
9798
return fetch(this.endpoint, {
@@ -104,7 +105,7 @@ export class JSONLogAttachment extends LogAttachment {
104105
tags,
105106
level: Object.entries(LogLevel).find(([k, v]) => v === level)[0],
106107
message: parts.join(' '),
107-
createdAt: new Date().toISOString()
108+
createdAt: date
108109
})
109110
})
110111
}).catch(e => console.error('Error in JSONLogAttachment', e))

0 commit comments

Comments
 (0)