fix: handle invalid logger in getLogger during runtime#1100
Closed
Mallikarjun-0 wants to merge 1 commit intochimurai:masterfrom
Closed
fix: handle invalid logger in getLogger during runtime#1100Mallikarjun-0 wants to merge 1 commit intochimurai:masterfrom
logger in getLogger during runtime#1100Mallikarjun-0 wants to merge 1 commit intochimurai:masterfrom
Conversation
Owner
|
Thanks for the PR @Mallikarjun-0 The real issue is caused by a bug in the types, resulting in Type http-proxy-middleware/src/types.ts Line 139 in d3851ed Created a PR to fix the Logger type: https://github.com/chimurai/http-proxy-middleware/pull/1104/files You should get a TypeScript error now when you provide an invalid Could you verify if this fix works for you? You can try the fix with: npm i https://pkg.pr.new/http-proxy-middleware@1104^ this preview is published from: #1104 (comment) |
Author
Owner
|
Thanks for raising the issue 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds runtime validation for the
loggeroption passed togetLogger. If the logger does not implement the required logging methods, the function now logs a warning and falls back to thenoopLogger. It can be changed to throw an error, which might lead to a "Breaking change".Motivation and Context
getLoggerassumes that if a logger is passed, it always matches the expectedLoggerinterface unless theloggeroption isundefinedor its value isnullwhere the original codereturn (options.logger as Logger) || noopLogger;returns noopLogger.Example:
How has this been tested?
Types of changes
Checklist: