system: simplify logic
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user