This package has been deprecated

Author message:

resin-event-log is deprecated, please use @balena/event-log instead

resin-event-log

1.25.1 • Public • Published

Balena Event Log

Balena event logging facility.

Installing

$ npm install resin-event-log

Using

var EventLog = require('resin-event-log')
 
var eventLogger = EventLog({
    debug: true,
    mixpanelToken: MIXPANEL_TOKEN,
    mixpanelHost: 'api.mixpanel.com',
    gaSite: 'balena-cloud.com',
    gaId: GA_ID,
    prefix: 'UI, CLI, etc.',
    // Hooks:
    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)
        }
    }
})
 
// Example logged event:
eventLoger.user.login(
    { json: 'data' }, // Or null
    'Application ID', // Optional
    'Device ID' // Optional
)
 
// Example logged event without params:
eventLoger.user.login()

Options

  • prefix - subsystem name like UI or CLI, acts as events names prefix
  • [debug = false] — will print some warnings
  • [mixpanelToken = null] - if set events will be reported to mixpanel
  • [mixpanelHost = null] - if set will override the default mixpanel API host
  • [gaSite = null], [gaSite = null] - if set events will be reported to GA

Hooks:

beforeCreate = function (type, jsonData, applicationId, deviceId, callback) { return callback() } 
afterCreate = function (error, type, jsonData, applicationId, deviceId) {}

Readme

Keywords

none

Package Sidebar

Install

npm i resin-event-log

Weekly Downloads

3

Version

1.25.1

License

Apache-2.0

Unpacked Size

60.3 kB

Total Files

18

Last publish

Collaborators

  • balena.io