-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Allow overwriting Bun.stdout and Bun.stderr #14874
Comments
Would it suffice to replace the console.log = (...args) => {
writeToFile("filename", ...args);
}; |
That's what I'm doing right now but it doesn't feel like a correct solution. A way to tell Bun to write to a different |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Note that this feature request is about Bun.stdout and Bun.stderr. Console method are just one example of where these sinks are used. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Agreed. That's why I am using it, as I've stated. The feature request still stands. |
What is the problem this feature would solve?
I have a piece of code where a method writes to the standard output using
console.log
and when a condition is met, it should instead write to a file.I have no control over the implementation of the method, so I am looking for ways to redirect the
console.log
andconsole.error
calls.I tried doing this:
However the standard output and standard error streams remained the terminal-attached ones, the file was created, but remained empty.
What is the feature you are proposing to solve the problem?
Make
Bun.stdout
andBun.stderr
read-write and respect the overriden values when using these internally as sinks forconsole
methods. (But this should probably also affectprocess.stdout
andprocess.stderr
maybe?What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: