Add API to get crash logs

This commit is contained in:
Girish Ramakrishnan
2019-03-01 15:45:44 -08:00
parent 452fe9f76d
commit 7bce63d74e
3 changed files with 12 additions and 11 deletions

View File

@@ -295,7 +295,8 @@ function getLogs(unit, options, callback) {
// need to handle box.log without subdir
if (unit === 'box') args.push(path.join(paths.LOG_DIR, 'box.log'));
else args.push(path.join(paths.LOG_DIR, unit, 'app.log'));
else if (unit.startsWith('crash-')) args.push(path.join(paths.CRASH_LOG_DIR, unit.slice(6) + '.log'));
else return callback(new CloudronError(CloudronError.BAD_FIELD, 'No such unit'));
var cp = spawn('/usr/bin/tail', args);