Skip to content

Commit

Permalink
Prevent override of regular logs by interactive ones
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiosinani committed Jun 1, 2018
1 parent a0da14b commit dd06050
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion signale.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const pkgConf = require('pkg-conf');
const pkg = require('./package.json');
const defaultTypes = require('./types');

let isPreviousLogInteractive = false;
const defaults = pkg.options.default;
const namespace = pkg.name;

Expand Down Expand Up @@ -99,12 +100,13 @@ class Signale {
}

_write(stream, message) {
if (this._interactive) {
if (this._interactive && isPreviousLogInteractive) {
stream.moveCursor(0, -1);
stream.clearLine();
stream.cursorTo(0);
}
stream.write(message + '\n');
isPreviousLogInteractive = this._interactive;
}

_formatStream(stream) {
Expand Down

0 comments on commit dd06050

Please sign in to comment.