Skip to content

Commit

Permalink
Merge pull request #58 from mattberther/symlink_option
Browse files Browse the repository at this point in the history
allow option to determine creation of current symlink (default: false)
  • Loading branch information
rogerc committed Sep 9, 2019
2 parents 77e8ba9 + b66acb5 commit f1af403
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FileStreamRotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ var EventEmitter = require('events');
*
* - `watch_log` Watch the current file being written to and recreate it in case of accidental deletion. Defaults to 'FALSE'
*
* - `create_symlink` Create a tailable symlink. Defaults to 'FALSE'
*
* To use with Express / Connect, use as below.
*
* var rotatingLogStream = require('FileStreamRotator').getStream({filename:"/tmp/test.log", frequency:"daily", verbose: false})
Expand Down Expand Up @@ -442,6 +444,7 @@ FileStreamRotator.getStream = function (options) {
curDate = (options.frequency ? self.getDate(frequencyMetaData,dateFormat, options.utc) : "");
}

options.create_symlink = options.create_symlink || false;
options.extension = options.extension || ""
var filename = options.filename;
var oldFile = null;
Expand Down Expand Up @@ -517,7 +520,9 @@ FileStreamRotator.getStream = function (options) {
stream.on("new",function(newLog){
// console.log("new log", newLog)
stream.auditLog = self.addLogToAudit(newLog,stream.auditLog, stream)
createCurrentSymLink(newLog)
if(options.create_symlink){
createCurrentSymLink(newLog)
}
if(options.watch_log){
stream.emit("addWatcher", newLog)
}
Expand Down

0 comments on commit f1af403

Please sign in to comment.