Sha256: 55e19cb05fcc63eaf02c76321b53ce547b25af14f0e9cd5b145fc6e35dc4dff5

Contents?: true

Size: 1.27 KB

Versions: 54

Compression:

Stored size: 1.27 KB

Contents

/**
 * App-level log APIs for nutella
 */

var AppNetSubModule = require('./app_net');

var AppLogSubModule = function(main_nutella) {
    this.net = new AppNetSubModule(main_nutella);
};



AppLogSubModule.prototype.debug = function(message, code) {
    console.debug(message);
    this.net.publish('logging', logToJson(message, code, 'debug'));
    return code;
};

AppLogSubModule.prototype.info = function(message, code) {
    console.info(message);
    this.net.publish('logging', logToJson(message, code, 'info'));
    return code;
};

AppLogSubModule.prototype.success = function(message, code) {
    console.log('%c '+ message , 'color: #009933');
    this.net.publish('logging', logToJson(message, code, 'success'));
    return code;
};

AppLogSubModule.prototype.warn = function(message, code) {
    console.warn(message);
    this.net.publish('logging', logToJson(message, code, 'warn'));
    return code;
};

AppLogSubModule.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 = AppLogSubModule;

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
nutella_framework-0.6.8 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.7 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.6 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.5 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.4 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.3 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.2 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.1 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.6.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.5.1 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.5.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.32 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.31 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.30 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.29 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.28 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.27 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.26 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.25 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js
nutella_framework-0.4.24 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js