Balena Event Log
Balena event logging facility.
Installing
$ npm install @balena/event-log
Using
var EventLog = require('@balena/event-log')
var eventLogger = EventLog({
debug: true,
prefix: 'UI, CLI, etc.',
beforeCreate: function (type, jsonData, applicationId, deviceId, callback) {
this.start('User ID', callback)
}
afterCreate: function (error, type, jsonData, applicationId, deviceId) {
if (type === 'User Logout') {
this.end()
}
if (error) {
console.error(error)
}
}
})
eventLoger.user.login(
{ json: 'data' },
'Application ID',
'Device ID'
)
eventLoger.user.login()
Options
prefix
- subsystem name like UI or CLI, acts as events names prefix[debug = false]
— will print some warnings
Hooks:
beforeCreate = function (type, jsonData, applicationId, deviceId, callback) { return callback() }
afterCreate = function (error, type, jsonData, applicationId, deviceId) {}