mirror of
https://github.com/vvsviridov/enm-cli.git
synced 2025-10-23 08:22:21 +00:00
first alpha
This commit is contained in:
26
util/logAlarm.js
Executable file
26
util/logAlarm.js
Executable 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
|
Reference in New Issue
Block a user