Sha256: 01dd240d7267b55a9890e03a4ba0f9c549ee60107f667326bdcaec9a5f25c5d3

Contents?: true

Size: 1.26 KB

Versions: 54

Compression:

Stored size: 1.26 KB

Contents

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

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

var FrLogSubModule = function(main_nutella) {
    this.net = new FrNetSubModule(main_nutella);
};



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

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

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

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

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

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
nutella_framework-0.9.2 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.9.1 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.9.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.8.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.7.3 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.7.2 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.7.1 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.7.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.21 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.20 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.19 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.18 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.17 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.16 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.15 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.13 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.12 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.11 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.10 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js
nutella_framework-0.6.9 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js