Browse Source

app log time format fix

all-modes
pbca26 8 years ago
parent
commit
5142da761d
  1. 4
      routes/shepherd.js

4
routes/shepherd.js

@ -103,13 +103,13 @@ shepherd.writeLog = function(data) {
const timeFormatted = new Date(Date.now()).toLocaleString().replace('AM', '').replace('PM', ''); const timeFormatted = new Date(Date.now()).toLocaleString().replace('AM', '').replace('PM', '');
if (fs.existsSync(logLocation + '/agamalog.txt')) { if (fs.existsSync(logLocation + '/agamalog.txt')) {
fs.appendFile(logLocation + '/agamalog.txt', new Date(Date.now()).toLocaleString() + ' ' + data + '\r\n', function (err) { fs.appendFile(logLocation + '/agamalog.txt', timeFormatted + ' ' + data + '\r\n', function (err) {
if (err) { if (err) {
console.log('error writing log file'); console.log('error writing log file');
} }
}); });
} else { } else {
fs.writeFile(logLocation + '/agamalog.txt', new Date(Date.now()).toLocaleString() + ' ' + data + '\r\n', function (err) { fs.writeFile(logLocation + '/agamalog.txt', timeFormatted + ' ' + data + '\r\n', function (err) {
if (err) { if (err) {
console.log('error writing log file'); console.log('error writing log file');
} }

Loading…
Cancel
Save