From e504c1385c1fc7bc7eb82511e182493b4b61fdc4 Mon Sep 17 00:00:00 2001 From: Ingo Fischer Date: Sun, 29 Dec 2019 16:46:41 +0100 Subject: [PATCH] fixes https://github.com/winstonjs/winston-daily-rotate-file/issues/125 by also checking for gz filename before deleting --- daily-rotate-file.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/daily-rotate-file.js b/daily-rotate-file.js index 66e3285..5c74d93 100644 --- a/daily-rotate-file.js +++ b/daily-rotate-file.js @@ -102,6 +102,14 @@ var DailyRotateFile = function (options) { }); this.logStream.on('logRemoved', function (params) { + if (options.zippedArchive) { + var gzName = params.name + '.gz'; + if (fs.existsSync(gzName)) { + fs.unlinkSync(gzName); + self.emit('logRemoved', gzName); + return; + } + } self.emit('logRemoved', params.name); });