0.0.3 • Published 9 years ago

logich-file-dated v0.0.3

Weekly downloads
12
License
-
Repository
-
Last release
9 years ago

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!");