Socket
Book a DemoInstallSign in
Socket

humix-logger

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

humix-logger - npm Package Compare versions

Comparing version

to
1.0.2

test/test.js

37

index.js

@@ -24,2 +24,4 @@ /*******************************************************************************

var os = require('os');
var util = require('util');
var colors = require('colors');

@@ -60,4 +62,4 @@ /**

{
level: options.consoleLevel || 'info',
stream: process.stdout
level: options.consoleLevel || 'error',
stream: consoleStream
},

@@ -71,2 +73,31 @@ {

return logger;
};
};
var levelIndex = {
60: 'FATAL',
50: 'ERROR',
40: ' WARN',
30: ' INFO',
20: 'DEBUG',
10: 'TRACE'
};
var colorIndex = {
60: colors.red,
50: colors.red,
40: colors.yellow,
30: colors.blue,
20: colors.green,
10: colors.gray
};
var consoleStream = {
write: writeToStdOut
};
function writeToStdOut(data) {
var obj = JSON.parse(data);
var msg = util.format('%s: %s',
colorIndex[obj.level](levelIndex[obj.level]), obj.msg);
console.log(msg);
}

5

package.json
{
"name": "humix-logger",
"version": "1.0.1",
"version": "1.0.2",
"description": "A utility module to create logger instance for humix projects",

@@ -24,4 +24,5 @@ "main": "index.js",

"dependencies": {
"bunyan": "^1.8.1"
"bunyan": "^1.8.1",
"colors": "^1.1.2"
}
}