-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: Logger settings for feature servers and updated logger for permission flow #4531
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
Merged
Merged
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
added/updated logger for permission flow
Signed-off-by: Abdul Hameed <ahameed@redhat.com>
- Loading branch information
commit 1b5a8fc21e69d0cf3cb20185d875a77283b0f28c
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,9 @@ def __init__(self, access_token: str, *args, **kwargs): | |
|
|
||
| def call_completed(self, exception): | ||
| if exception: | ||
| print(f"{AuthorizationMiddleware.__name__} received {exception}") | ||
| logger.error( | ||
| f"{AuthorizationMiddleware.__name__} encountered an exception: {exception}" | ||
| ) | ||
|
|
||
| async def extract_user(self) -> User: | ||
| """ | ||
|
|
@@ -69,14 +71,14 @@ def inject_user_details(context: ServerCallContext): | |
| context: The endpoint context. | ||
| """ | ||
| if context.get_middleware("auth") is None: | ||
| logger.info("No `auth` middleware.") | ||
| logger.warning("No `auth` middleware.") | ||
| return | ||
|
|
||
| sm = get_security_manager() | ||
| if sm is not None: | ||
| auth_middleware = cast(AuthorizationMiddleware, context.get_middleware("auth")) | ||
| current_user = asyncio.run(auth_middleware.extract_user()) | ||
| print(f"extracted user: {current_user}") | ||
| logger.info(f"User extracted: {current_user}") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to log every user using info?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't set as a debug incase if required |
||
|
|
||
| sm.set_current_user(current_user) | ||
|
|
||
|
|
||
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.
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.
The better way to log exception is
logging.exceptionI m not sure what it logs if we do the{exception}.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.
set as logging.exception. These will arrow flight sever related internal exceptions.