logich-file-dated
v0.0.3
Published
logich middleware to write logs to different files every day.
Downloads
7
Maintainers
Readme
logich
middleware to write logs to files timestamped with a date.
Install:
npm install logich
npm install logich-file-dated
Usage:
var logich = require("logich");
var datedfile = require("logich-file-dated");
var logger = logich()
.use(logich.object)
.use(logich.time)
.use(logich.json)
.use(datedfile());
logger.log("Hello world!");
This will create log files in the current directory with the following filename format ./logs-YYYY-MM-DD.txt
.
You can specify your custom file name formattign options:
var logger = logich()
.use(datedfile({
// These are default settings:
format: "YYYY-MM-DD", // Time formatting as you would supply to `moment.js`, see http://momentjs.com/docs/#/displaying/
dir: "./", // Directory where to write files.
prefix: "logs-", // File name prefix.
suffix: ".txt" // File name suffix.
}));
logger.log("Hello world!");