1.25.1 • Published 4 years ago

resin-event-log v1.25.1

Weekly downloads
7
License
Apache-2.0
Repository
github
Last release
4 years ago

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) {}
1.25.1

4 years ago

1.25.0

4 years ago

1.24.0

4 years ago

1.23.0

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.0

5 years ago

1.19.0

5 years ago

1.18.0

5 years ago

1.17.1

5 years ago

1.17.0

5 years ago

1.16.0

5 years ago

1.15.0

5 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.1

5 years ago

1.11.0

5 years ago

1.10.0

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago