Skip to content

Commit

Permalink
feat(log): add --error flag to ghost log
Browse files Browse the repository at this point in the history
closes #432
- add an error flag that loads the error log as opposed to the full access log
  • Loading branch information
acburdine committed Nov 29, 2017
1 parent 5ed1cfe commit 462a58f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/commands/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LogCommand extends Command {
}));
}

const logFileName = path.join(instance.dir, 'content/logs', `${instance.config.get('url').replace(/[^\w]/gi, '_')}_${this.system.environment}.log`);
const logFileName = path.join(instance.dir, 'content/logs', `${instance.config.get('url').replace(/[^\w]/gi, '_')}_${this.system.environment}${argv.error ? '.error' : ''}.log`);
const prettyStream = new PrettyStream();

if (!fs.existsSync(logFileName)) {
Expand Down Expand Up @@ -85,6 +85,11 @@ LogCommand.options = {
alias: 'f',
description: 'Follow the log file (similar to `tail -f`)',
type: 'boolean'
},
error: {
alias: 'e',
description: 'If provided, only show the error log',
type: 'boolean'
}
};
LogCommand.global = true;
Expand Down

0 comments on commit 462a58f

Please sign in to comment.