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

chore: patch winston to suppress padLevels warning #18824

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions patches/winston+2.4.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/node_modules/winston/lib/winston/common.js b/node_modules/winston/lib/winston/common.js
index 8ed9973..ecc59f8 100644
--- a/node_modules/winston/lib/winston/common.js
+++ b/node_modules/winston/lib/winston/common.js
@@ -32,7 +32,10 @@ exports.setLevels = function (target, past, current, isDefault) {
}

target.levels = current || config.npm.levels;
- if (target.padLevels) {
+ // Check if `padLevels` exists to suppress a warning about accessing
+ // a non-existing property on `exports`.
+ // @see https://github.com/winstonjs/winston/issues/1882
+ if (target.hasOwnProperty('padLevels') && target.padLevels) {
target.levelLength = exports.longestElement(Object.keys(target.levels));
}