1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

Minimal start with a custom logger and device tracker.

This commit is contained in:
Simo Kinnunen 2014-01-07 10:55:41 +09:00
parent 971fcb8297
commit f67eb6dd25
7 changed files with 126 additions and 0 deletions

26
lib/provider.js Normal file
View file

@ -0,0 +1,26 @@
var adb = require('adbkit')
var async = require('async')
var log = require('./util/logger').createLogger('provider')
var client = adb.createClient()
client.trackDevices(function(err, tracker) {
if (err) {
log.fatal('Unable to track devices: %s', err.message)
throw err
}
log.info('Tracking devices')
tracker.on('add', function(device) {
log.info('Found device "%s" (%s)', device.id, device.type)
})
tracker.on('change', function(device) {
log.info('Device "%s" is now "%s"', device.id, device.type)
})
tracker.on('remove', function(device) {
log.info('Lost device "%s" (%s)', device.id, device.type)
})
})