pitaya-launcher/js/util/debug.js

18 lines
479 B
JavaScript
Raw Normal View History

var debug = require('debug');
var util = require('util');
module.exports = function createLogger(namespace) {
var logger = debug('pitaya:'+namespace);
2015-09-11 16:25:45 +02:00
var isNWContext = 'window' in global;
var console = isNWContext ? global.window.console : global.console;
logger.log = function() {
2015-09-11 16:25:45 +02:00
if(isNWContext) {
console.log.apply(console, arguments);
} else {
var str = util.format.apply(util, arguments);
console.log(str);
}
};
return logger;
};