diff --git a/src/system.js b/src/system.js index 7810b2fd5..25bffbde6 100644 --- a/src/system.js +++ b/src/system.js @@ -300,12 +300,9 @@ async function getLogs(unit, options) { assert.strictEqual(typeof unit, 'string'); assert(options && typeof options === 'object'); - debug(`Getting logs for ${unit}`); - - let logFile = ''; - if (unit === 'box') logFile = path.join(paths.LOG_DIR, 'box.log'); // box.log is at the top - else throw new BoxError(BoxError.BAD_FIELD, `No such unit '${unit}'`); + if (unit !== 'box') throw new BoxError(BoxError.BAD_FIELD, `No such unit '${unit}'`); + const logFile = path.join(paths.LOG_DIR, 'box.log'); const cp = logs.tail([logFile], { lines: options.lines, follow: options.follow }); const logStream = new logs.LogStream({ format: options.format || 'json', source: unit });