From 1f26428e055016b4f771238ac0fc25613e4aa458 Mon Sep 17 00:00:00 2001 From: Essem Date: Thu, 7 May 2026 23:22:36 -0500 Subject: [PATCH] refactor: Use standard Winston file transport The file rotation package seemingly wasn't providing much practical utility. If you need this functionality, you can use an external tool such as logrotate. --- package.json | 1 - pnpm-lock.yaml | 35 ----------------------------------- src/utils/logger.ts | 9 ++++----- 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index fd5f80ac..48705d2d 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,6 @@ "postgres": "^3.4.9", "shoukaku": "^4.3.0", "winston": "^3.19.0", - "winston-daily-rotate-file": "^5.0.0", "ws": "^8.20.0" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4eb32202..d06fdeb2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,9 +44,6 @@ importers: winston: specifier: ^3.19.0 version: 3.19.0 - winston-daily-rotate-file: - specifier: ^5.0.0 - version: 5.0.0(winston@3.19.0) ws: specifier: ^8.20.0 version: 8.20.0(bufferutil@4.1.0) @@ -710,9 +707,6 @@ packages: fecha@4.2.3: resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==} - file-stream-rotator@0.6.1: - resolution: {integrity: sha512-u+dBid4PvZw17PmDeRcNOtCP9CCK/9lRN2w+r1xIS7yOL9JFrIBKTvrYsxT4P0pGtThYTn++QS5ChHaUov3+zQ==} - file-type@22.0.1: resolution: {integrity: sha512-ww5Mhre0EE+jmBvOXTmXAbEMuZE7uX4a3+oRCQFNj8w++g3ev913N6tXQz0XTXbueQ5TWQfm6BdaViEHHn8bhA==} engines: {node: '>=22'} @@ -889,9 +883,6 @@ packages: module-details-from-path@1.0.4: resolution: {integrity: sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==} - moment@2.30.1: - resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} - ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -921,10 +912,6 @@ packages: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} - object-hash@3.0.0: - resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} - engines: {node: '>= 6'} - oceanic.js@1.14.0: resolution: {integrity: sha512-h8KfbN0GEWoi4kiHXj10uJzQe+L//VMZX6cRDBU4GuGP8wNDWsami20wbpErP8fFzN78kpVshF3g70vd/niP3g==} engines: {node: '>=18.13.0'} @@ -1177,12 +1164,6 @@ packages: engines: {node: ^20.17.0 || >=22.9.0} hasBin: true - winston-daily-rotate-file@5.0.0: - resolution: {integrity: sha512-JDjiXXkM5qvwY06733vf09I2wnMXpZEhxEVOSPenZMii+g7pcDcTBt2MRugnoi8BwVSuCT2jfRXBUy+n1Zz/Yw==} - engines: {node: '>=8'} - peerDependencies: - winston: ^3 - winston-transport@4.9.0: resolution: {integrity: sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==} engines: {node: '>= 12.0.0'} @@ -1782,10 +1763,6 @@ snapshots: fecha@4.2.3: {} - file-stream-rotator@0.6.1: - dependencies: - moment: 2.30.1 - file-type@22.0.1: dependencies: '@tokenizer/inflate': 0.4.1 @@ -1964,8 +1941,6 @@ snapshots: module-details-from-path@1.0.4: optional: true - moment@2.30.1: {} - ms@2.1.3: {} napi-build-utils@2.0.0: {} @@ -1986,8 +1961,6 @@ snapshots: normalize-path@3.0.0: optional: true - object-hash@3.0.0: {} - oceanic.js@1.14.0(bufferutil@4.1.0): dependencies: tslib: 2.8.1 @@ -2358,14 +2331,6 @@ snapshots: dependencies: isexe: 3.1.1 - winston-daily-rotate-file@5.0.0(winston@3.19.0): - dependencies: - file-stream-rotator: 0.6.1 - object-hash: 3.0.0 - triple-beam: 1.4.1 - winston: 3.19.0 - winston-transport: 4.9.0 - winston-transport@4.9.0: dependencies: logform: 2.7.0 diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 1446f828..ff1ff8ff 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,6 +1,5 @@ import process from "node:process"; import winston from "winston"; -import "winston-daily-rotate-file"; const logger = winston.createLogger({ levels: { @@ -15,17 +14,17 @@ const logger = winston.createLogger({ format: winston.format.colorize({ all: true }), stderrLevels: ["error", "warn"], }), - new winston.transports.DailyRotateFile({ + new winston.transports.File({ filename: "logs/error-%DATE%.log", level: "error", zippedArchive: true, - maxSize: 4194304, + maxsize: 4194304, maxFiles: 8, }), - new winston.transports.DailyRotateFile({ + new winston.transports.File({ filename: "logs/main-%DATE%.log", zippedArchive: true, - maxSize: 4194304, + maxsize: 4194304, maxFiles: 8, }), ], -- 2.51.2