balena-cli/lib/actions/logs.coffee
Juan Cruz Viotti 05812ba442 Implement and make use of errors.handleCallback()
This function is introduced to remove some duplication
2015-01-09 12:22:18 -03:00

15 lines
399 B
CoffeeScript

resin = require('resin-sdk')
permissions = require('../permissions/permissions')
log = require('../log/log')
errors = require('../errors/errors')
LOGS_HISTORY_COUNT = 200
exports.logs = permissions.user (params, options) ->
resin.logs.subscribe params.uuid, {
history: options.num or LOGS_HISTORY_COUNT
tail: options.tail
}, errors.handleCallback (message) ->
log.array(message, log.out)