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

Update readme to document multiple streams and streams per type #29

Merged
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
24 changes: 22 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ custom.santa('Hoho! You have an unused variable on L45.');
<img alt="Custom Loggers" src="media/custom-loggers.png" width="70%">
</div>

Setting the stream property of a type will write to that stream (or streams) for that specific type.

```js
const {Signale} = require('signale');

const options = {
types: {
error: {
badge: figures.cross,
color: 'red',
label: 'error',
stream: [process.stdout, process.stderr]
}
}
};

const custom = new Signale(options);
custom.error('I\'m going to two streams!');
```

Additionally, all default loggers can be overridden to your own preference.

Here is an example where we override the default `error` and `success` loggers.
Expand Down Expand Up @@ -174,10 +194,10 @@ The `options` object can hold the `stream`, `scope` and `types` attributes, wher

##### `stream`

- Type: `Writable stream`
- Type: `Writable stream` or `Array of writable streams`
- Default: `process.stdout`

Destination to which the data is written, can be any valid [Writable stream](https://nodejs.org/api/stream.html#stream_writable_streams).
Destination to which the data is written, can be any valid [Writable stream](https://nodejs.org/api/stream.html#stream_writable_streams). All streams in an array will be written to.

##### `scope`

Expand Down