add option alwaysIncludePattern to dateTime appender to always use the filename with the pattern included when logging
This commit is contained in:
@@ -19,10 +19,10 @@ process.on('exit', function() {
|
||||
* also used to check when to roll files - defaults to '.yyyy-MM-dd'
|
||||
* @layout layout function for log messages - defaults to basicLayout
|
||||
*/
|
||||
function appender(filename, pattern, layout) {
|
||||
function appender(filename, pattern, alwaysIncludePattern, layout) {
|
||||
layout = layout || layouts.basicLayout;
|
||||
|
||||
var logFile = new streams.DateRollingFileStream(filename, pattern);
|
||||
var logFile = new streams.DateRollingFileStream(filename, pattern, alwaysIncludePattern);
|
||||
openFiles.push(logFile);
|
||||
|
||||
return function(logEvent) {
|
||||
@@ -37,12 +37,16 @@ function configure(config, options) {
|
||||
if (config.layout) {
|
||||
layout = layouts.layout(config.layout.type, config.layout);
|
||||
}
|
||||
|
||||
if (!config.alwaysIncludePattern) {
|
||||
config.alwaysIncludePattern = false;
|
||||
}
|
||||
|
||||
if (options && options.cwd && !config.absolute) {
|
||||
config.filename = path.join(options.cwd, config.filename);
|
||||
}
|
||||
|
||||
return appender(config.filename, config.pattern, layout);
|
||||
return appender(config.filename, config.pattern, config.alwaysIncludePattern, layout);
|
||||
}
|
||||
|
||||
exports.appender = appender;
|
||||
|
||||
Reference in New Issue
Block a user