Skip to content

Commit

Permalink
Update readme for multiple streams and stream per type
Browse files Browse the repository at this point in the history
  • Loading branch information
jordrake committed May 30, 2018
1 parent 3872e8c commit 9701c23
Showing 1 changed file with 22 additions and 2 deletions.
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

0 comments on commit 9701c23

Please sign in to comment.