-
Notifications
You must be signed in to change notification settings - Fork 1.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
[Feature Request]: Add option to Console transport for logging through console.log #2175
Comments
Added a "forceConsole" option, to force use "console.log" |
Referenced commit is in PR #2276 for better cross-ref. |
I'm inclined to close for reasoning described here - do you think that applies? |
I opened this issue with the VSCode team for this very reason. As I explored the issue, it became clear what was happening. If I understand correctly when you use The reasoning here doesn't apply for the reasons in the bug I opened. In short, using the While it's true that one could create one's own Console transport, that's a lot of replication of a core component for what amounts to 3 lines of code. Are you open to reconsidering this? The PR seems pretty innocuous to me and would be fully backward-compatible. |
FWIW, an alternative approach would be to move the
Into a public method. That way, people could extend the transport and just override that method. |
The reasoning that is cited:
is misleading. I'm not asking for Winston to switch to I don't see why you wouldn't want to do this, given that multiple people are asking for this and it can be backwards compatible. People will continue opening feature requests for this as long as the option isn't there. Consider the fact that if #982 was merged 6 years ago, you would have avoided many issues related to this and I would've never opened this issue. You would be saving time for users and yourself. |
🔎 Search Terms
console.log, jest, lambda
The vision
The Console transport should have a configuration option so that users can choose whether logging is done through
process.stdout.write
(the default currently) orconsole.log
. I believe pull request #982 would resolve my issue and related issues from others.Use case
The fact that Winston uses
process.stdout.write
instead ofconsole.log
has been the root cause of several problems for me:--silent
option, which means I can no longer control the output from tests from the command line.None of these things were problems before when using
console.log
. I spent several hours researching and creating workarounds for each of these situations just to get Winston to the same level of functionality thatconsole.log
provides. Winston does not document anywhere that it defaults to stdout for the Console transport, which means that many people have to spend time debugging problems related to the usage of stdout and digging through the Winston source code.I believe that all of these problems (in addition to VSCode and Chrome debugging issues mentioned in #981, #1305, #1544) could be solved by just adding a configuration option to the Console transport to override use of stdout. There have been pull requests to fix this like #982 but they have been closed. I do not see why giving users more customization options is a bad thing, after all shouldn't the user be able to decide what's best for them?
This issue will continue to bite people in unforeseen and different ways as long as it remains unaddressed because many applications simply do not expect you to use stdout and do not support using it. There are already examples where this has affected popular tools and services like VS Code, Chrome, Jest, and AWS Lambda.
Additional information
No response
The text was updated successfully, but these errors were encountered: