-
Notifications
You must be signed in to change notification settings - Fork 20
feat: setup controller runtime logger #42
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
Conversation
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
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.
Pull Request Overview
This PR sets up the controller-runtime logger using the zap package to improve log readability by removing trace stack clutter. It adds the necessary import and logger initialization in both the memberagent and hubagent main packages.
- In cmd/memberagent/main.go, the logger is configured with zap in development mode.
- In cmd/hubagent/main.go, similar logger initialization is added.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/memberagent/main.go | Added zap import and initialized the controller-runtime logger using DevMode. |
| cmd/hubagent/main.go | Added zap import and similarly set up the controller-runtime logger. |
| }) | ||
|
|
||
| // Set up controller-runtime logger | ||
| ctrl.SetLogger(zap.New(zap.UseDevMode(true))) |
Copilot
AI
Apr 30, 2025
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.
[nitpick] Consider making the logger mode configurable (e.g., via a command-line flag or environment variable) instead of hard-coding dev mode to better support production environments.
| ctrl.SetLogger(zap.New(zap.UseDevMode(true))) | |
| ctrl.SetLogger(zap.New(zap.UseDevMode(*devMode))) |
| } | ||
|
|
||
| // Set up controller-runtime logger | ||
| ctrl.SetLogger(zap.New(zap.UseDevMode(true))) |
Copilot
AI
Apr 30, 2025
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.
[nitpick] Consider making the zap logger's development mode configurable to allow switching between development and production logging settings.
| ctrl.SetLogger(zap.New(zap.UseDevMode(true))) | |
| ctrl.SetLogger(zap.New(zap.UseDevMode(devMode))) |
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
Description of your changes
Fixes #
I have: setup controller runtime logger to remove trace stack and share logs
make reviewableto ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer
Using
DevModeto make it more human readable.Example logs:
