From a78faf5a7c9000ce6934f765f896cd11660a562f Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sun, 14 Mar 2021 21:05:12 -0600 Subject: [PATCH] change log format --- src/util.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index 5dc3eea..13fe178 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,10 +1,16 @@ import PhoneNumber from "awesome-phonenumber"; -import winston from "winston"; +import winston, { format } from "winston"; export const DEBUG = !!process.env.DEBUG; export const logger = winston.createLogger({ level: DEBUG ? "debug" : process.env.LOG_LEVEL ?? "info", transports: [new winston.transports.Console()], + format: format.combine( + format.timestamp(), + format.printf( + ({ level, message, timestamp }) => `${timestamp} [${level}]: ${message}` + ) + ), }); export function getNationalNumber(input: string) {