mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2025-02-23 06:35:19 +01:00
30 lines
No EOL
783 B
JavaScript
30 lines
No EOL
783 B
JavaScript
var fs = require('fs');
|
|
var path = require('path');
|
|
var file_path = path.normalize(__dirname + '/..') + '/RTL.log';
|
|
var common = require('../common');
|
|
|
|
exports.info = (msgStr) => {
|
|
console.log('Console: ' + msgStr);
|
|
if(common.enable_logging) {
|
|
fs.appendFile(file_path, 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(file_path, msgStr, function(err) {
|
|
if (err) {
|
|
return ({ error: 'Updating Log Failed!' });
|
|
} else {
|
|
return ({ message: 'Log Updated Successfully' });
|
|
}
|
|
});
|
|
}
|
|
} |