Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "errorlog", | ||
"description": "Yet another logger for Node", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Pier Fumagalli", |
@@ -11,2 +11,3 @@ 'use strict'; | ||
log1('I have %d %s, and an object %j', 3, 'apples', { foo: 'bar' }); | ||
log1.trace('A trace message'); | ||
log1.debug('A debug message'); | ||
@@ -16,2 +17,3 @@ log1.info('Informational message'); | ||
log1.error('Something is wrong...'); | ||
log1.fatal('Something is really REALLY wrong...'); | ||
@@ -23,2 +25,3 @@ console.log('\n... When a category is specified...\n'); | ||
log2('I have %d %s and an error', 2, 'mangoes', new Error('Hello, world!')); | ||
log2.trace('Useful when tracing'); | ||
log2.debug('A debug message with some extra', {foo: "bar", baz: 12345}); | ||
@@ -28,2 +31,3 @@ log2.info('Informational message'); | ||
log2.error('Something is wrong...'); | ||
log2.fatal('Something is really REALLY wrong...'); | ||
@@ -35,2 +39,3 @@ console.log('\n... Boring output with defaultColorize = false...\n'); | ||
log2('I have %d %s and an error', 2, 'mangoes', new Error('Hello, world!')); | ||
log2.trace('Useful when tracing'); | ||
log2.debug('A debug message with some extra', {foo: "bar", baz: 12345}); | ||
@@ -40,3 +45,4 @@ log2.info('Informational message'); | ||
log2.error('Something is wrong...'); | ||
log2.fatal('Something is really REALLY wrong...'); | ||
console.log('\n... There you go, all done...\n'); |
@@ -52,2 +52,3 @@ 'use strict'; | ||
var ALL = -1; | ||
var TRACE = 0; | ||
var DEBUG = 100; | ||
@@ -57,2 +58,3 @@ var INFO = 200; | ||
var ERROR = 400; | ||
var FATAL = 500; | ||
var OFF = Number.MAX_SAFE_INTEGER; | ||
@@ -133,6 +135,8 @@ var LOG = OFF - 1; // internal only | ||
if (colorize) { | ||
if (logLevel <= DEBUG) data.unshift('\x1B[38;5;25;4m'); | ||
if (logLevel <= TRACE) data.unshift('\x1B[38;5;23;4m'); | ||
else if (logLevel <= DEBUG) data.unshift('\x1B[38;5;25;4m'); | ||
else if (logLevel <= INFO) data.unshift('\x1B[38;5;70;4m'); | ||
else if (logLevel <= WARN) data.unshift('\x1B[38;5;100;4m'); | ||
else if (logLevel <= ERROR) data.unshift('\x1B[38;5;131;4m'); | ||
else if (logLevel <= FATAL) data.unshift('\x1B[38;5;124;4m'); | ||
else data.unshift('\x1B[38;5;37;4m'); | ||
@@ -146,13 +150,17 @@ } | ||
if (logLevel <= DEBUG) data.unshift('DEBUG'); | ||
if (logLevel <= TRACE) data.unshift('TRACE'); | ||
else if (logLevel <= DEBUG) data.unshift('DEBUG'); | ||
else if (logLevel <= INFO) data.unshift(' INFO'); | ||
else if (logLevel <= WARN) data.unshift(' WARN'); | ||
else if (logLevel <= ERROR) data.unshift('ERROR'); | ||
else if (logLevel <= FATAL) data.unshift('FATAL'); | ||
else data.unshift(' LOG'); | ||
if (colorize === true) { | ||
if (logLevel <= DEBUG) data.unshift('\x1B[38;5;33m'); | ||
if (logLevel <= TRACE) data.unshift('\x1B[38;5;30m'); | ||
else if (logLevel <= DEBUG) data.unshift('\x1B[38;5;33m'); | ||
else if (logLevel <= INFO) data.unshift('\x1B[38;5;76m'); | ||
else if (logLevel <= WARN) data.unshift('\x1B[38;5;142m'); | ||
else if (logLevel <= ERROR) data.unshift('\x1B[38;5;167m'); | ||
else if (logLevel <= FATAL) data.unshift('\x1B[38;5;160m'); | ||
else data.unshift('\x1B[38;5;44m'); | ||
@@ -166,2 +174,3 @@ } | ||
var logger = function log() { emit(LOG, arguments) } | ||
logger.trace = function trace() { emit(TRACE, arguments) } | ||
logger.debug = function debug() { emit(DEBUG, arguments) } | ||
@@ -171,2 +180,3 @@ logger.info = function info() { emit(INFO, arguments) } | ||
logger.error = function error() { emit(ERROR, arguments) } | ||
logger.fatal = function fatal() { emit(FATAL, arguments) } | ||
return logger; | ||
@@ -182,2 +192,3 @@ | ||
'ALL': { configurable: false, enumerable: true, writable: false, value: ALL }, | ||
'TRACE': { configurable: false, enumerable: true, writable: false, value: TRACE }, | ||
'DEBUG': { configurable: false, enumerable: true, writable: false, value: DEBUG }, | ||
@@ -187,2 +198,3 @@ 'INFO': { configurable: false, enumerable: true, writable: false, value: INFO }, | ||
'ERROR': { configurable: false, enumerable: true, writable: false, value: ERROR }, | ||
'FATAL': { configurable: false, enumerable: true, writable: false, value: FATAL }, | ||
'OFF': { configurable: false, enumerable: true, writable: false, value: OFF }, | ||
@@ -200,3 +212,3 @@ // Defaults | ||
get: function() { return defaultLevel }, | ||
set: function(level) { defaultLevel = Number(level) || ERROR } | ||
set: function(level) { defaultLevel = Number(level) || INFO } | ||
}, | ||
@@ -203,0 +215,0 @@ 'defaultColorize': { |
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
22641
422