Improve metric logging

This commit is contained in:
Eric Bailey
2026-01-22 12:39:41 -06:00
parent d130184434
commit 088639ffb8
2 changed files with 5 additions and 7 deletions
+4 -6
View File
@@ -43,17 +43,15 @@ export class MetricsClient<M extends Record<string, any>> {
) { ) {
this.start() this.start()
this.queue.push({ const e = {
time: Date.now(), time: Date.now(),
event, event,
payload, payload,
metadata, metadata,
}) }
this.queue.push(e)
logger.info(`event: ${event as string}`, { logger.info(`event: ${e.event as string}`, e)
payload,
__metadata__: metadata, // special logger field
})
if (this.queue.length > this.maxBatchSize) { if (this.queue.length > this.maxBatchSize) {
this.flush() this.flush()
+1 -1
View File
@@ -36,7 +36,7 @@ export const consoleTransport: Transport = (
if (IS_WEB) { if (IS_WEB) {
if (hasMetadata) { if (hasMetadata) {
console.groupCollapsed(msg) console.groupCollapsed(msg)
console.log(metadata) console.log(prepareMetadata(metadata))
console.groupEnd() console.groupEnd()
} else { } else {
console.log(msg) console.log(msg)