Levelfy
This framework is intend to extend the built in console object with the capability that allows developers to control over the log level of console output.
Install
NodeJS
npm install levelfy
Browser
Usage
Log to specified log level
Following methods will output the log to the specific log levels.
console; // error levelconsole; // warn levelconsole; // notice levelconsole; // info levelconsole; // debug level console; // info level ( it's an alias of console.info )
Specify the log level
Use the following statement to change the verbose level.
consolelogLevel = 'info'; // info level in string representationconsolelogLevel = 5; // info level in numeric representation
Following map are the accepted log levels and their corresponding verbose levels.
num | string | verbose level | description |
---|---|---|---|
1 | silent | Log nothing | |
2 | error | error | Log message at error level only |
3 | warn | warn, error | Log info at warn and error level |
4 | notice | notice, warn, error | Log info at notice, warn and error level |
5 | info | info, notice, warn, error | Log everything but message at debug level |
6 | debug | debug, info, notice, warn, error | Log eveything ( Temporarily ) |
7 | silly | debug, info, notice, warn, error | Log eveything ( Reserved for future extension ) |