Skip to content

Commit

Permalink
Attach logger to Console only when in terminal mode.
Browse files Browse the repository at this point in the history
If *mb* is started in background Console logging should be disabled.
If not whole *mb* could hang when kernel buffer is full.
  • Loading branch information
zedar authored and ndrwdn committed Oct 24, 2014
1 parent 0fa84ea commit 2f19157
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mountebank.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ function create (options) {
validateImposterExists = middleware.createImposterValidator(imposters);

logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, { colorize: true, level: options.loglevel });
if (process.stdout.isTTY) {
logger.add(logger.transports.Console, { colorize: true, level: options.loglevel });
}
logger.add(logger.transports.File, {
filename: options.logfile,
timestamp: true,
Expand Down

0 comments on commit 2f19157

Please sign in to comment.