mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 18:00:44 +01:00
30 lines
763 B
JavaScript
30 lines
763 B
JavaScript
var fs = require('fs');
|
|
var common = require('../common');
|
|
|
|
exports.info = (msgStr) => {
|
|
if (msgStr.indexOf('Config Setup Variable') === -1) {
|
|
console.log('Console: ' + msgStr);
|
|
}
|
|
if(common.enable_logging) {
|
|
fs.appendFile(common.log_file, msgStr, function(err) {
|
|
if (err) {
|
|
return ({ error: 'Updating Log Failed!' });
|
|
} else {
|
|
return ({ message: 'Log Updated Successfully' });
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
exports.error = (msgStr) => {
|
|
console.error('Console: ' + msgStr);
|
|
if(common.enable_logging) {
|
|
fs.appendFile(common.log_file, msgStr, function(err) {
|
|
if (err) {
|
|
return ({ error: 'Updating Log Failed!' });
|
|
} else {
|
|
return ({ message: 'Log Updated Successfully' });
|
|
}
|
|
});
|
|
}
|
|
} |