first alpha

This commit is contained in:
Vyacheslav.Sviridov
2022-06-09 20:52:09 +06:00
parent 8b3e8ae5c8
commit fc41ae955f
54 changed files with 2416 additions and 1976 deletions

26
util/logAlarm.js Executable file
View File

@@ -0,0 +1,26 @@
const chalk = require('chalk')
const eventTimeToString = require('./eventTimeToString')
const timeValues = [
'eventTime',
'insertTime',
'ceaseTime',
'ackTime',
]
function logAlarm(alarmList, eventPoId) {
const alarm = alarmList.filter(item => item.eventPoIdAsLong === eventPoId)[0]
timeValues.forEach(value => alarm[value] = eventTimeToString(alarm[value]))
console.log(
JSON.stringify(alarm, null, 2)
.replace(/["(){}\[\]]/mg, '')
.replace(/,$/mg, '')
.replace(/^(\s{2}\w+):/mg, chalk.green('$1:'))
)
}
module.exports = logAlarm