From b48d839a8aedad154ec19c3f0a631fe2c02d7344 Mon Sep 17 00:00:00 2001 From: Ingar Almklov Date: Wed, 13 Jan 2021 15:45:01 +0100 Subject: [PATCH] Change logging to output time in ISO-8601 --- server/start.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/start.ts b/server/start.ts index 53cdfbb5b..e4c3e287a 100644 --- a/server/start.ts +++ b/server/start.ts @@ -5,8 +5,9 @@ import cors from 'cors'; import express from 'express'; import exphbs from 'express-handlebars'; import helmet from 'helmet'; +import pino from 'pino'; import pinoColada from 'pino-colada'; -import pino from 'pino-http'; +import pinoHttp from 'pino-http'; import * as Config from './config'; import routes from './routes'; @@ -15,7 +16,7 @@ export default function startServer() { const app = express(); app.use( - pino({ + pinoHttp({ ...(Config.server.isDev ? { prettyPrint: true, @@ -27,6 +28,7 @@ export default function startServer() { return { level }; }, }, + timestamp: pino.stdTimeFunctions.isoTime, genReqId(req) { return req.headers['X-Correlation-ID'] || req.id; },