Skip to content

Commit

Permalink
feat: write to multiple streams (fixes klaudiosinani#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordrake committed May 30, 2018
1 parent 8be0371 commit db06a9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion signale.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ class Signale {
}

_log(message, stream = this._stream) {
stream.write(message + '\n');
this._formatStream(stream).forEach(stream => {
stream.write(message + '\n');
});
}

_formatStream(stream) {
return Array.isArray(stream) ? stream : [stream];
}

_formatDate() {
Expand Down
3 changes: 1 addition & 2 deletions types.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module.exports = {
error: {
badge: figures.cross,
color: 'red',
label: 'error',
stream: process.stderr
label: 'error'
},
fatal: {
badge: figures.cross,
Expand Down

0 comments on commit db06a9d

Please sign in to comment.