forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Separate router_v1 and router #4
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
Closed
zeripath
wants to merge
3
commits into
wxiaoguang:optimize-logger
from
zeripath:optimize-logger-router_v1
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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 can not understand why should we introduce so many setting options to keep the router_v1.
What's the Pros/Cons of using these options instead of ROUTER_LOG_LEVEL + ROUTER_LOG_HANDLER ? Is there any real case I can learn from?
And in my mind we might want to deprecate (remove) router v1 in future, but these options (code/document) make it more complex.
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 think it's clearer to separate out the old logger instead of overloading the meaning of the configuration parameters.
For example, your PR proposed changing the meaning of ROUTER_LOG_LEVEL to do something very different from what it does on the original router.
Then we simply deprecate these and remove them in 1.17 leaving in code that checks for the existence of the configuration - which causes a warning that this has been removed and finally in 1.18 remove even the check.
If we use the
ROUTER_LOG_HANDLER=v2then we're gonna end up having to keep checking that version and there's no way for a user to have both routers running for a while so they can migrate more easily.Uh oh!
There was an error while loading. Please reload this page.
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.
IMO, we should unify and simplify the logger system, instead of introducing new specialized settings to make it more complex. Maybe we can narrow down the changes to:
ROUTER_LOG_HANDLERI can not imagine a real use case for users to use v1 and v2 and the same time.
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.
@zeripath bump ~~
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.
Adding suffices of V1 to the configuration of the ROUTER_V1 is the right thing to do here. It means that if you want the old router behaviour - or need it whilst you're migrating you configure it as ROUTER_V1 and ROUTER_V1_LOG_LEVEL.
I don't see any benefit to ROUTER_LOG_HANDLER.
I can easily imagine a use case for v1 and v2 - temporarily - I wouldn't have written this code if I couldn't see it.
Uh oh!
There was an error while loading. Please reload this page.
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.
ROUTER_LOG_HANDLER is much easier and simpler than introducing many new setting options like ENABLE_ROUTER_V1 / ROUTER_V1 / ROUTER_V1_LOG_LEVEL.
To be honest, I still can not get the point why v1 and v2 should co-exist.
Even if the v1 and v2 co-exist temporarily, that should be for development and refactoring purpose. After this PR gets merged (and we finish the refactoring), are there still users who need to see v1 and v2 logs at the same time? What could they do after reading v1 and v2 logs? If they want to see the differences, they can simply first use v1 to collect some logs and then use v2 to collect logs. If they decide to stay with v1, just set ROUTER_LOG_HANDLER=v1, if they decide to migrate to v2, just set ROUTER_LOG_HANDLER=v2, no need to make v1 and v2 co-exist.