mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Send logcat messages to group.
This commit is contained in:
@@ -321,6 +321,7 @@ module.exports = function(options) {
|
||||
return adb.openLogcatAsync(options.serial)
|
||||
.then(function(logcat) {
|
||||
services.logcat = vitals.register('device:logcat', logcat)
|
||||
resetLogcat()
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
@@ -402,7 +403,7 @@ module.exports = function(options) {
|
||||
})
|
||||
})
|
||||
.on(wire.LogcatApplyFiltersMessage, function(channel, message) {
|
||||
services.logcat.resetFilters().excludeAll()
|
||||
resetLogcat()
|
||||
message.filters.forEach(function(filter) {
|
||||
services.logcat.include(filter.tag, filter.priority)
|
||||
})
|
||||
@@ -474,6 +475,27 @@ module.exports = function(options) {
|
||||
return !!owner
|
||||
}
|
||||
|
||||
function resetLogcat() {
|
||||
services.logcat
|
||||
.resetFilters()
|
||||
.excludeAll()
|
||||
}
|
||||
|
||||
function logcatListener(entry) {
|
||||
push.send([
|
||||
owner.group
|
||||
, wireutil.envelope(new wire.DeviceLogcatEntryMessage(
|
||||
options.serial
|
||||
, entry.date.getTime() / 1000
|
||||
, entry.pid
|
||||
, entry.tid
|
||||
, entry.priority
|
||||
, entry.tag
|
||||
, entry.message
|
||||
))
|
||||
])
|
||||
}
|
||||
|
||||
function joinGroup(newOwner, timeout) {
|
||||
log.info('Now owned by "%s"', newOwner.email)
|
||||
log.info('Subscribing to group channel "%s"', newOwner.group)
|
||||
@@ -486,6 +508,7 @@ module.exports = function(options) {
|
||||
, newOwner
|
||||
))
|
||||
])
|
||||
services.logcat.on('entry', logcatListener)
|
||||
owner = newOwner
|
||||
}
|
||||
|
||||
@@ -501,6 +524,7 @@ module.exports = function(options) {
|
||||
, owner
|
||||
))
|
||||
])
|
||||
services.logcat.removeListener('entry', logcatListener)
|
||||
owner = null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user