diff --git a/lib/streams/DateRollingFileStream.js b/lib/streams/DateRollingFileStream.js index 9da029a..0ac3ec5 100644 --- a/lib/streams/DateRollingFileStream.js +++ b/lib/streams/DateRollingFileStream.js @@ -17,7 +17,14 @@ function DateRollingFileStream(filename, pattern, options, now) { } this.pattern = pattern || '.yyyy-MM-dd'; this.now = now || Date.now; - this.lastTimeWeWroteSomething = format.asString(this.pattern, new Date(this.now())); + + if (fs.existsSync(filename)) { + var stat = fs.statSync(filename); + this.lastTimeWeWroteSomething = format.asString(this.pattern, stat.mtime); + } else { + this.lastTimeWeWroteSomething = format.asString(this.pattern, new Date(this.now())); + } + this.baseFilename = filename; this.alwaysIncludePattern = false;