dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/glogg/index.js
Cyryl Płotnicki 2f946d6200 Add .vscode
2016-09-11 10:29:13 +02:00

34 lines
520 B
JavaScript

'use strict';
var format = require('util').format;
var sparkles = require('sparkles');
var levels = [
'debug',
'info',
'warn',
'error'
];
function getLogger(namespace){
var logger = sparkles(namespace);
levels.forEach(function(level){
logger[level] = makeLogLevel(level);
});
return logger;
}
function makeLogLevel(level){
return function(msg){
if(typeof msg === 'string'){
msg = format.apply(null, arguments);
}
this.emit(level, msg);
};
}
module.exports = getLogger;