2015-01-08 12:04:37 +00:00
|
|
|
resin = require('resin-sdk')
|
2014-12-12 21:20:29 +00:00
|
|
|
permissions = require('../permissions/permissions')
|
2014-12-22 16:41:14 +00:00
|
|
|
log = require('../log/log')
|
2014-12-22 16:47:12 +00:00
|
|
|
errors = require('../errors/errors')
|
2014-11-28 16:46:24 +00:00
|
|
|
|
2015-01-09 12:42:46 +00:00
|
|
|
LOGS_HISTORY_COUNT = 200
|
2014-11-29 00:51:03 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
exports.logs = permissions.user (params, options) ->
|
|
|
|
|
2015-01-09 13:34:26 +00:00
|
|
|
resin.logs.subscribe params.uuid, {
|
2015-01-09 12:42:46 +00:00
|
|
|
history: options.num or LOGS_HISTORY_COUNT
|
|
|
|
tail: options.tail
|
2015-01-09 15:22:18 +00:00
|
|
|
}, errors.handleCallback (message) ->
|
2015-01-09 12:42:46 +00:00
|
|
|
log.array(message, log.out)
|