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

Remove winston-daily-rotate-file side-effects if you're not using logging #264

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

MadLittleMods
Copy link
Contributor

Remove winston-daily-rotate-file side-effects if you're not using logging

Context: https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/2040#note_438055746

Without this change, I was seeing TypeError: Cannot set property DailyRotateFile of #<Object> which has only a getter
errors when using with Gitter which also has winston@2 installed.

@@ -121,6 +120,10 @@ class Logging {
maxFiles: 5
*/
configure(config: LoggerConfig = {}) {
// `winston-daily-rotate-file` has side-effects so we don't want to mess anyone up
// unless they want to use logging
require("winston-daily-rotate-file");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This did fix my problem but #243 is still a problem.

Interestingly, I can still run Logging.configure({ level: 'silent' }); which imports the problem library anyway.

I haven't tested whether winston-daily-rotate-file still does it's job though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest importing it at 157, because that's when we invoke DailyRotateFile? Otherwise this is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Fixed up the build as well

@MadLittleMods MadLittleMods force-pushed the remove-winston-daily-rotate-file-side-effects branch 3 times, most recently from 7bb0462 to 1061a34 Compare October 30, 2020 03:09
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @Half-Shot 🦀

…ging

Context: https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/2040#note_438055746

Without this change, I was seeing `TypeError: Cannot set property DailyRotateFile of #<Object> which has only a getter`
errors when using with Gitter which also has `winston@2` installed.
@MadLittleMods MadLittleMods force-pushed the remove-winston-daily-rotate-file-side-effects branch from 1061a34 to c60353a Compare October 30, 2020 03:19
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

Looks great to me 👍

@Half-Shot Half-Shot merged commit 518ef75 into develop Oct 30, 2020
@Half-Shot Half-Shot deleted the remove-winston-daily-rotate-file-side-effects branch May 2, 2023 16:06
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.

2 participants