egg-logrotator
Advanced tools
Comparing version 3.0.6 to 3.0.7
@@ -8,2 +8,3 @@ 'use strict'; | ||
const Rotator = require('./rotator'); | ||
const utils = require('../../utils'); | ||
@@ -24,11 +25,6 @@ | ||
const loggers = this.app.loggers; | ||
for (const key in loggers) { | ||
if (loggers.hasOwnProperty(key)) { | ||
const logger = loggers[key]; | ||
this._setFile(logger.options.file, files); | ||
if (logger.options.jsonFile) { | ||
this._setFile(logger.options.jsonFile, files); | ||
} | ||
} | ||
} | ||
const loggerFiles = utils.walkLoggerFile(loggers); | ||
loggerFiles.forEach(file => { | ||
this._setFile(file, files); | ||
}); | ||
@@ -35,0 +31,0 @@ // Should rotate agent log, because schedule is running under app worker, |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const moment = require('moment'); | ||
const utils = require('../../utils'); | ||
@@ -18,16 +19,7 @@ // clean all xxx.log.YYYY-MM-DD beofre expried date. | ||
const logDirs = new Set(); | ||
for (const key in app.loggers) { | ||
if (!app.loggers.hasOwnProperty(key)) { | ||
continue; | ||
} | ||
const registeredLogger = app.loggers[key]; | ||
for (const transport of registeredLogger.values()) { | ||
const file = transport.options.file; | ||
if (file) { | ||
const logDir = path.dirname(transport.options.file); | ||
logDirs.add(logDir); | ||
} | ||
} | ||
} | ||
const loggerFiles = utils.walkLoggerFile(app.loggers); | ||
loggerFiles.forEach(file => { | ||
const logDir = path.dirname(file); | ||
logDirs.add(logDir); | ||
}); | ||
const maxDays = app.config.logrotator.maxDays; | ||
@@ -34,0 +26,0 @@ if (maxDays && maxDays > 0) { |
3.0.7 / 2019-03-14 | ||
================== | ||
**fixes** | ||
* [[`4c1632b`](http://github.com/eggjs/egg-logrotator/commit/4c1632be11fd527de80acc8bdda22568c5960bd1)] - fix: all rotator should use transport file (#25) (Hongcai Deng <<admin@dhchouse.com>>) | ||
3.0.6 / 2019-03-06 | ||
@@ -3,0 +9,0 @@ ================== |
{ | ||
"name": "egg-logrotator", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "logrotator for egg", | ||
@@ -22,3 +22,4 @@ "eggPlugin": { | ||
"agent.js", | ||
"app.js" | ||
"app.js", | ||
"utils.js" | ||
], | ||
@@ -25,0 +26,0 @@ "dependencies": { |
26783
19
392