Fix line param parsing

lines is a positive integer or -1 to disable line limiting. The
default value is 10 if no argument is given.

Fixes #604
This commit is contained in:
Girish Ramakrishnan
2019-01-08 12:10:53 -08:00
parent 1affb2517a
commit 810f5e7409
9 changed files with 48 additions and 37 deletions

View File

@@ -869,16 +869,19 @@ function getLogs(appId, options, callback) {
assert(options && typeof options === 'object');
assert.strictEqual(typeof callback, 'function');
assert.strictEqual(typeof options.lines, 'number');
assert.strictEqual(typeof options.format, 'string');
assert.strictEqual(typeof options.follow, 'boolean');
debug('Getting logs for %s', appId);
get(appId, function (error, app) {
if (error) return callback(error);
var lines = options.lines || 100,
var lines = options.lines === -1 ? '+1' : options.lines,
format = options.format || 'json',
follow = !!options.follow;
follow = options.follow;
assert.strictEqual(typeof lines, 'number');
assert.strictEqual(typeof format, 'string');
var args = [ '--lines=' + lines ];