logich-file-dated

0.0.3 • Public • Published

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

Package Sidebar

Install

npm i logich-file-dated

Weekly Downloads

1

Version

0.0.3

License

none

Last publish

Collaborators

  • streamich