Skip to content

Commit ec0a535

Browse files
committed
fix: logging api version as well
1 parent 1f0191c commit ec0a535

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

api/src/core/log.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { pino } from 'pino';
22
import pretty from 'pino-pretty';
33

4-
import { LOG_TYPE } from '@app/environment.js';
4+
import { API_VERSION, LOG_TYPE } from '@app/environment.js';
55

66
export const levels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'] as const;
77

@@ -10,9 +10,7 @@ export type LogLevel = (typeof levels)[number];
1010
const level =
1111
levels[levels.indexOf(process.env.LOG_LEVEL?.toLowerCase() as (typeof levels)[number])] ?? 'info';
1212

13-
export const logDestination = pino.destination({
14-
sync: true,
15-
});
13+
export const logDestination = pino.destination();
1614

1715
const stream =
1816
LOG_TYPE === 'pretty'
@@ -28,9 +26,10 @@ const stream =
2826
export const logger = pino(
2927
{
3028
level,
31-
timestamp: () => `,"time":"${new Date().toISOString()}",`,
29+
timestamp: pino.stdTimeFunctions.isoTime,
3230
formatters: {
3331
level: (label: string) => ({ level: label }),
32+
bindings: (bindings) => ({ ...bindings, apiVersion: API_VERSION }),
3433
},
3534
redact: {
3635
paths: [

0 commit comments

Comments
 (0)