Emit rotate events for log files based on interval. Rotate event handlers are called "rotator-tots" or just tots. Tots get passed a (readable stream, the log file path, and the data passed in when the log was asociated).
var rotator = require('rotator');
var tot = rotator();
tot.addFile('./some.log',function(err){
if(err) throw err; // oh no could not find the log or somthing
console.log('log scheduled for rotation!');
});
tot.on('rotate',function(rs,file,data){
// stop writing to the log
// also upload it to s3? content-length is fs.stat.size
// rs.pipe ....
});
tot.on('rotated',function(rs,path,data){
console.log(rs,'was old and needed to be rotated. copied to ',path);
// prints "./some.log was old and needed to be rotated. copied to ./20120914_some.log"
});
rotator(config Object)
tot EventEmitter
Events
Data Object data objects are passed to events. this is the data associated with each file.
let me know if you have victory