Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for multiple streams & optional streams per logger. Fixes #26 #27

Merged
merged 2 commits into from
May 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions signale.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ class Signale {
}

_logger(type, ...messageObj) {
this._log(this._buildSignale(this._types[type], ...messageObj));
this._log(this._buildSignale(this._types[type], ...messageObj), this._types[type].stream);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

}

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

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

_formatDate() {
Expand Down