Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding rotationFormat prop to file.js
The goal of the rotation format property is to allow the user to pass a pointer to a function that will determine the format of the file name in case of a rotating logger (a logger with maxsize that generated files). sample usage: this will make the files created under "log" to be named: run<yyyyMMddhhmmss>.log ex: run20130629190056.log run20130629190057.log and so forth... winston.add(winston.transports.File, { filename: 'log/run.log', maxsize: 150, rotationFormat: function() { return getFormattedDate(); function getFormattedDate() { var temp = new Date(); return dateStr = padStr(temp.getFullYear()) + padStr(1 + temp.getMonth()) + padStr(temp.getDate()) + padStr(temp.getHours()) + padStr(temp.getMinutes()) + padStr(temp.getSeconds()); } function padStr(i) { return (i < 10) ? "0" + i : "" + i; } } });
- Loading branch information