hf-node-logger
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "hf-node-logger", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A logger module with loglevels", | ||
@@ -5,0 +5,0 @@ "main": "logger.js", |
# hf-node-logger | ||
Logger Module for Node | ||
Laser Fox Logger Module for Node | ||
![laserfox](http://i.giphy.com/Ko5dZRMv9uJFu.gif) | ||
## Installation | ||
simple installation | ||
``` | ||
npm install hf-node-logger | ||
``` | ||
require it in your file | ||
```javascript | ||
var logger = require('hf-node-logger')(); | ||
``` | ||
## Loglevel | ||
There are multiple loglevel: | ||
1. debug | ||
For debugging information | ||
2. info | ||
For the 'normal' stream of events | ||
3. warning | ||
For things which are uncritical but someone should have a look | ||
4. severe | ||
For things that should not happen | ||
5. critical | ||
For things that are breaking the System | ||
## configuration | ||
Require the module and define your loglevel. | ||
```javascript | ||
var config = { | ||
stdOut : console.log, | ||
errOut : console.error, | ||
level : DEBUG, | ||
name : 'AppLog' | ||
}; | ||
``` | ||
and call the initializer which is returned by the require statement | ||
```javascript | ||
var logger = require('hf-node-logger')(config); | ||
``` | ||
If you don't specify any, the default loglevel is 'info'. | ||
## usage | ||
generic use: | ||
```javascript | ||
logger.log(<LOGLEVEL>, <LOGTEXT>); | ||
``` | ||
result: | ||
``` | ||
<TIMESTAMP> | <NAME> | <LOGLEVEL> | <LOGTEXT> | ||
``` | ||
## Shortcuts | ||
There are specified shortcuts for every loglevel: | ||
### debug | ||
```javascript | ||
logger.debug(<LOGTEXT>); | ||
``` | ||
### info | ||
```javascript | ||
logger.info(<LOGTEXT>); | ||
``` | ||
### warning | ||
```javascript | ||
logger.warning(<LOGTEXT>); | ||
``` | ||
### severe | ||
```javascript | ||
logger.severe(<LOGTEXT>); | ||
``` | ||
### critical | ||
```javascript | ||
logger.critical(<LOGTEXT>); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5087
83