Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mylogger

vermaslal85NONE1.1.5

logging based on console

console, logger, mylogger, nodejs logger, logging

readme

mylogger

This module enables you to create logging based on console

Setting up

npm install mylogger

Usage

Input

// Patch console.x methods in order to add timestamp information
var logger = require("mylogger");
logger.setLevel('debug');// either of 'log', 'debug', 'info', 'notice', 'warn', 'error'
//logger.setLogPath('/var/log/testLog.txt'); //optional, if not set it will pipe to stdout
//use either setLogPath or useRotate
logger.useRotate({
    dir: "/var/log",
    fileName: "test.log",
    rotateType: "minute", //minute/day/week/month/year
    dateFormat: "yyyymmddhhMM",// a valid date format. For more see https://www.npmjs.com/package/dateformat Date formate will prepend on filename
    useNewDir: true //if it is true there will be separate dir instead of appending on filename
});
logger.log("Hello", 'world');
logger.info("iiiiiiii", {txt: ['dummy']}, 'world');
logger.error("EEEEE", 'world')
logger.warn("ww", 'world')
logger.log("Hello World!", 'world');

Output

2015-11-26 15:24:02 [INFO] iiiiiiii { txt: [ 'dummy' ] } world
2015-11-26 15:24:02 [ERROR] EEEEE world
2015-11-26 15:24:02 [WARN] ww world