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

Save a reference to console methods in console transport #2498

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

neilenns
Copy link
Contributor

@neilenns neilenns commented Aug 8, 2024

Fixes #2497

  • Save local references to console.log, console.warn, and console.error
  • Use those references instead of the original methods when logging

@Jimbly could you please give this a try and see if it fixes your circular reference issue? I could never get a circular reference, but I did get other errors that no longer happen with this change and logging seems to work fine.

Copy link
Contributor

@DABH DABH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM up to comment - but also want @Jimbly to test ideally :)

lib/winston/transports/console.js Outdated Show resolved Hide resolved
@DABH
Copy link
Contributor

DABH commented Aug 8, 2024

Will wait a day or so to see if @Jimbly can give us the 👍 on this one but it does look like it's in the spirit of the fix that was being discussed... thanks!

Copy link

@Jimbly Jimbly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

lib/winston/transports/console.js Outdated Show resolved Hide resolved
@neilenns neilenns requested review from Jimbly and DABH August 8, 2024 19:20
@DABH
Copy link
Contributor

DABH commented Aug 8, 2024

Will merge and ship this as a patch release (I think that feels appropriate), please feel free to try out the new version (to be released imminently) and lmk what you think. Thanks again for the contributions!

@DABH DABH merged commit e82752f into winstonjs:master Aug 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: forceConsole may cause circular reference if console.log is redirected to Winston
3 participants