2019-01-13 17:55:25 -05:00
|
|
|
var fs = require('fs');
|
|
|
|
var common = require('../common');
|
|
|
|
|
2019-04-06 18:42:09 -04:00
|
|
|
exports.info = (msgStr, selNode = common.nodes[0]) => {
|
2019-02-13 21:31:26 -05:00
|
|
|
if (msgStr.indexOf('Config Setup Variable') === -1) {
|
|
|
|
console.log('Console: ' + msgStr);
|
|
|
|
}
|
2019-04-06 18:42:09 -04:00
|
|
|
if(selNode.enable_logging) {
|
2019-04-05 22:52:00 -04:00
|
|
|
fs.appendFile(selNode.log_file, msgStr, function(err) {
|
|
|
|
if (err) {
|
|
|
|
return ({ error: 'Updating Log Failed!' });
|
|
|
|
} else {
|
|
|
|
return ({ message: 'Log Updated Successfully' });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-01-13 17:55:25 -05:00
|
|
|
}
|
|
|
|
|
2019-04-06 18:42:09 -04:00
|
|
|
exports.error = (msgStr, selNode = common.nodes[0]) => {
|
2019-01-13 17:55:25 -05:00
|
|
|
console.error('Console: ' + msgStr);
|
2019-04-06 18:42:09 -04:00
|
|
|
if(selNode.enable_logging) {
|
2019-04-05 22:52:00 -04:00
|
|
|
fs.appendFile(selNode.log_file, msgStr, function(err) {
|
|
|
|
if (err) {
|
|
|
|
return ({ error: 'Updating Log Failed!' });
|
|
|
|
} else {
|
|
|
|
return ({ message: 'Log Updated Successfully' });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-01-13 17:55:25 -05:00
|
|
|
}
|