Sha256: 8dce688682fa817a09d62d589f7fef4b935d18e47eaf0f5c37e2ca6e1dd24f56
Contents?: true
Size: 1.24 KB
Versions: 54
Compression:
Stored size: 1.24 KB
Contents
/** * Run-level Logging APIs for nutella */ var NetSubModule = require('./run_net'); var LogSubModule = function(main_nutella) { this.net = new NetSubModule(main_nutella); }; LogSubModule.prototype.debug = function(message, code) { console.debug(message); this.net.publish('logging', logToJson(message, code, 'debug')); return code; }; LogSubModule.prototype.info = function(message, code) { console.info(message); this.net.publish('logging', logToJson(message, code, 'info')); return code; }; LogSubModule.prototype.success = function(message, code) { console.log('%c '+ message , 'color: #009933'); this.net.publish('logging', logToJson(message, code, 'success')); return code; }; LogSubModule.prototype.warn = function(message, code) { console.warn(message); this.net.publish('logging', logToJson(message, code, 'warn')); return code; }; LogSubModule.prototype.error = function(message, code) { console.error(message); this.net.publish('logging', logToJson(message, code, 'error')); return code; }; function logToJson( message, code, level) { return (code===undefined) ? {level: level, message: message} : {level: level, message: message, code: code}; } module.exports = LogSubModule;
Version data entries
54 entries across 54 versions & 1 rubygems