From 4b6e97cf93876549dfb97d4c2ae4b79b46055171 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Thu, 24 Mar 2022 20:39:05 +0530 Subject: [PATCH] feat: log timestamps in ISO format --- src/Defaults/index.ts | 4 ++-- src/Utils/logger.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/Utils/logger.ts diff --git a/src/Defaults/index.ts b/src/Defaults/index.ts index 6eb742b..7432359 100644 --- a/src/Defaults/index.ts +++ b/src/Defaults/index.ts @@ -1,6 +1,6 @@ -import P from 'pino' import type { CommonSocketConfig, LegacySocketConfig, MediaType, SocketConfig } from '../Types' import { Browsers } from '../Utils' +import logger from '../Utils/logger' import { version } from './baileys-version.json' export const UNAUTHORIZED_CODES = [401, 403, 419] @@ -25,7 +25,7 @@ const BASE_CONNECTION_CONFIG: CommonSocketConfig = { waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat', connectTimeoutMs: 20_000, keepAliveIntervalMs: 25_000, - logger: P().child({ class: 'baileys' }), + logger: logger.child({ class: 'baileys' }), printQRInTerminal: false, emitOwnEvents: true, defaultQueryTimeoutMs: 60_000, diff --git a/src/Utils/logger.ts b/src/Utils/logger.ts new file mode 100644 index 0000000..bb651e3 --- /dev/null +++ b/src/Utils/logger.ts @@ -0,0 +1,3 @@ +import P from 'pino' + +export default P({ timestamp: () => `,"time":"${new Date().toJSON()}"` }) \ No newline at end of file