Android Log Cat Inspired Logger for NodeJS
Installation
$ npm install --save jlogger
A simple logger inspired by Android LogCat for NodeJS. This logger provides functions like Log.e(), Log.w(), Log.i() and Log.d() as in Android App Development. The display is as
**Note: Known issues when running with forever.js. Run with --colors if colors are not showing. **
Usage
var Log = ; Log; //Default tag for every log var TAG = "some TAG"; Log; //This msg will be in redLog; //This msg will be in red Log; //In yellowLog; //In yellow Log; //In greenLog; //In green Log; //This is white Log; //Specify colorLog; //Specify color. Default is white Log; //Draw a dashed horizontal line. Default length is that of the terminal
If you want a new instance of the Logger, having different properties from global config use:
var Log = ;var Log2 = "defaultTag": "another default tag"; Log2;// orLog;
Available customisations
Log;
Using Log.hr()
Log;
length: Number Number of characters to draw. Default is set by global Config showTimeStamp: true/false Whether to show timestamp. Default is false color: color name Color for the horizontal line tag: tag tag for hr char: "=" String with which the hr is to be drawn. (tag parameter should be present, atleast an empty placeholder)
Sections
You can create a section in your terminal by using Log.section().
//color : The color of section divider. Default is blue//msg: message to be inserted in center of line//char: character to draw section divider withLog;
JSON formatting
No need to stringify the json to display. The module displays it with correct indentation.
var obj = name: "Jibin Mathews" email: "jibinmathews7@gmail.com"; Log;orLog;
Release Notes
- Release 1.3.0
- Added Sectioning
- Release 1.2.0
- Added JSON formatting
- Text wrapping (Changed from character based wrapping to word based wrapping)
- Bug fix with setting config
- Release 1.1.0
- Added horizontal rule
- Release 1.0.0
- Initial Release