-
Notifications
You must be signed in to change notification settings - Fork 73
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
Remove winston-daily-rotate-file side-effects if you're not using logging #264
Conversation
src/components/logging.ts
Outdated
@@ -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"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
7bb0462
to
1061a34
Compare
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.
1061a34
to
c60353a
Compare
There was a problem hiding this 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 👍
Remove
winston-daily-rotate-file
side-effects if you're not using loggingContext: 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.