-
Notifications
You must be signed in to change notification settings - Fork 111
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
Remove glog #527
Remove glog #527
Conversation
Thanks for your PR,
To skip the vendors CIs use one of:
|
Pull Request Test Coverage Report for Build 6643614723
💛 - Coveralls |
Thanks for your PR,
To skip the vendors CIs use one of:
|
1 similar comment
Thanks for your PR,
To skip the vendors CIs use one of:
|
199956d
to
ffb562a
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
2 similar comments
Thanks for your PR,
To skip the vendors CIs use one of:
|
Thanks for your PR,
To skip the vendors CIs use one of:
|
2f989eb
to
196bae5
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
1 similar comment
Thanks for your PR,
To skip the vendors CIs use one of:
|
Thanks for your PR,
To skip the vendors CIs use one of:
|
1 similar comment
Thanks for your PR,
To skip the vendors CIs use one of:
|
ad3c31d
to
f9b2894
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
- create new log pkg to handle log initialization and setup - update operator, daemon and webhook log setup and init logic Signed-off-by: adrianc <adrianc@nvidia.com>
Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime log Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime log Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime logs Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime logs Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime log Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime logs Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime logs Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime logs Signed-off-by: adrianc <adrianc@nvidia.com>
remove glog flags from manifest Signed-off-by: adrianc <adrianc@nvidia.com>
update logs to use controller-runtime logs Signed-off-by: adrianc <adrianc@nvidia.com>
Signed-off-by: adrianc <adrianc@nvidia.com>
f9b2894
to
37924ef
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
/test-all |
Sample log from sriov config daemon:
|
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.
looks great thanks for the effort!
/lgtm
LGTM Question, why is the old log package still an indirect dependency? |
maybe because of dependency on sriov device plugin ? |
@@ -48,7 +48,7 @@ var ( | |||
Use: "start", | |||
Short: "Starts SR-IOV Network Config Daemon", | |||
Long: "", | |||
Run: runStartCmd, | |||
RunE: runStartCmd, |
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.
RunE?
@@ -35,10 +33,12 @@ import ( | |||
"k8s.io/client-go/rest" | |||
"k8s.io/client-go/tools/clientcmd" | |||
"k8s.io/client-go/util/connrotation" | |||
"sigs.k8s.io/controller-runtime/pkg/log" |
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 better if we import "sigs.k8s.io/controller-runtime/pkg/log" only in the new log package of the sriov operator. For instance, here I see that you use it to get a new logger instance with a name element. Therefore, you could mask this function in the log package. Something like
func WithName(name string) logr.Logger {
return log.Log.WithName(name)
}
|
||
// To help debugging, immediately log version | ||
glog.V(2).Infof("Version: %+v", version.Version) | ||
setupLog.V(2).Info("sriov-network-config-daemon", "version", version.Version) |
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.
could you please remind me why we call the V function to get a new logger with different level? Just wondering if we could simplify this now that you making some changes for logging.
rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine) | ||
} | ||
|
||
func main() { | ||
if err := rootCmd.Execute(); err != nil { | ||
glog.Exitf("Error executing mcd: %v", err) | ||
log.Log.Error(err, "error executing sriov-network-config-daemon") |
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.
let's get the logger from the new log package. You can have there. I believe all files should only import the new log package and not other log related imports.
import "sigs.k8s.io/controller-runtime/pkg/log"
var Log = log.Log
|
||
// handleLogLevelChange handles log level change | ||
func (dn *Daemon) handleLogLevelChange(logLevel int) { | ||
newLevel := int8(logLevel * -1) |
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.
perhaps you can use log.Log.V(logLevel).Enabled() to verify whether the new level is the same or not. You won't need to have a reference to the zap package.
Too late for comments. Already merged. |
Remove the use of glog package.
use controller-runtime logging & zap instead.
roughly 460 substitutions required.