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

Multiple write streams? #26

Closed
ivokund opened this issue May 27, 2018 · 3 comments · Fixed by #27
Closed

Multiple write streams? #26

ivokund opened this issue May 27, 2018 · 3 comments · Fixed by #27
Assignees
Labels
feature request Request for a new feature

Comments

@ivokund
Copy link

ivokund commented May 27, 2018

Hi,

Signale is awesome, but any idea how should I handle real life use cases such as logging stuff into console AND logging stuff into filesystem or websockets? It seems like a heavy limitation to have maximum one out stream available in config?

Thanks!

@klaudiosinani klaudiosinani added the feature request Request for a new feature label May 27, 2018
@klaudiosinani klaudiosinani self-assigned this May 27, 2018
@klaudiosinani
Copy link
Owner

At the moment it is not possible, but it will not be too hard to implement, it should be available on the upcoming release. Thank you for taking the time to suggest it : )

@ivokund
Copy link
Author

ivokund commented May 27, 2018

Thanks for a quick response! Any approximate ETA on the next release? :)

@rsify
Copy link

rsify commented May 29, 2018

I've came across the problem of multiple output streams as well today, here's what I'm using for now:

const fs = require('fs')
const {PassThrough} = require('stream')

const stripAnsiStream = require('strip-ansi-stream')
const {Signale} = require('signale')

const ps = new PassThrough()

ps.pipe(process.stdout)
ps.pipe(stripAnsiStream).pipe(fs.createWriteStream('out.txt'))

const signale = new Signale({
	stream: ps
})

It makes so that signale's methods write both to stdout and out.txt (without colors) at the same time. You can optionally call ps.end() after being done with the writing. Hope it's helpful for someone who encountered this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants