hf-node-logger
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -0,4 +1,6 @@ | ||
var colors = require('colors'); | ||
module.exports = function(options){ | ||
var DEBUG = 'debug' | ||
var DEBUG = 'debug'; | ||
var INFO = 'info'; | ||
@@ -22,2 +24,18 @@ var WARNING = 'warning'; | ||
var colors = function(level){ | ||
DEBUG = DEBUG.blue; | ||
INFO = INFO.cyan; | ||
WARNING = WARNING.yellow; | ||
SEVERE = SEVERE.magenta; | ||
CRITICAL = CRITICAL.red; | ||
methods.critical = function(message){ | ||
log(CRITICAL, message.red); | ||
}; | ||
if (level !== CRITICAL){ | ||
methods.severe = function(message){ | ||
log(SEVERE, message.magenta); | ||
}; | ||
} | ||
}; | ||
stdOut = options.stdOut || console.log; | ||
@@ -28,15 +46,2 @@ errOut = options.errOut || console.error; | ||
var log = function(level, message){ | ||
var timestamp = new Date(); | ||
message = timestamp+' | '+name+' | '+level+' | '+message; | ||
if(level === INFO || level === WARNING){ | ||
stdOut(message); | ||
}else if(level === SEVERE || level === CRITICAL){ | ||
errOut(message); | ||
}else{ | ||
errOut('loglevel is not supported for:\n'+message); | ||
} | ||
} | ||
if (level !== CRITICAL){ | ||
@@ -63,4 +68,21 @@ methods.severe = function(message){ | ||
options.colors && colors(level); | ||
var log = function(level, message){ | ||
var timestamp = new Date(); | ||
message = timestamp+' | '+name+' | '+level+' | '+message; | ||
if(level === DEBUG || level === INFO || level === WARNING){ | ||
stdOut(message); | ||
}else if(level === SEVERE || level === CRITICAL){ | ||
errOut(message); | ||
}else{ | ||
errOut('loglevel is not supported for:\n'+message); | ||
} | ||
} | ||
return methods; | ||
} |
{ | ||
"name": "hf-node-logger", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "A logger module with loglevels", | ||
@@ -23,3 +23,6 @@ "main": "logger.js", | ||
}, | ||
"homepage": "https://github.com/HitFox/hf-node-logger#readme" | ||
"homepage": "https://github.com/HitFox/hf-node-logger#readme", | ||
"dependencies": { | ||
"colors": "^1.1.2" | ||
} | ||
} |
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
5925
6
78
1
+ Addedcolors@^1.1.2
+ Addedcolors@1.4.0(transitive)