balena-cli/lib/actions/logs.coffee

16 lines
417 B
CoffeeScript
Raw Normal View History

2015-01-08 12:04:37 +00:00
resin = require('resin-sdk')
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
LOGS_HISTORY_COUNT = 200
2014-11-29 00:51:03 +00:00
exports.logs = permissions.user (params, options) ->
2015-01-09 13:34:26 +00:00
resin.logs.subscribe params.uuid, {
history: options.num or LOGS_HISTORY_COUNT
tail: options.tail
}, (error, message) ->
2014-12-22 16:47:12 +00:00
errors.handle(error) if error?
log.array(message, log.out)