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.queue.push({
const e = {
time: Date.now(),
event,
payload,
metadata,
})
}
this.queue.push(e)
logger.info(`event: ${event as string}`, {
payload,
__metadata__: metadata, // special logger field
})
logger.info(`event: ${e.event as string}`, e)
if (this.queue.length > this.maxBatchSize) {
this.flush()
+1 -1
View File
@@ -36,7 +36,7 @@ export const consoleTransport: Transport = (
if (IS_WEB) {
if (hasMetadata) {
console.groupCollapsed(msg)
console.log(metadata)
console.log(prepareMetadata(metadata))
console.groupEnd()
} else {
console.log(msg)