pbacsko commented on code in PR #611:
URL: https://github.com/apache/yunikorn-k8shim/pull/611#discussion_r1228354935
##########
pkg/log/logger.go:
##########
@@ -30,13 +33,99 @@ var once sync.Once
var logger *zap.Logger
var zapConfigs *zap.Config
+// LoggerHandle is used to efficiently look up logger references
+type LoggerHandle struct {
+ name string
+}
+
+func (h LoggerHandle) String() string {
+ return h.name
+}
+
+// Logger names
+const (
+ defaultLog = "log.level"
+ logPrefix = "log."
+ levelSuffix = ".level"
+)
+
+var K8Shim = LoggerHandle{name: "k8shim"}
+var Kubernetes = LoggerHandle{name: "kubernetes"}
+var Admission = LoggerHandle{name: "admission"}
+var Test = LoggerHandle{name: "test"}
Review Comment:
If we manage all loggers, we can get faster logger retrieval by defining an
extra "int" field in `LoggerHandle` which tells the index of the `*zap.Logger`
instance inside a slice. We can still use the map for less commonly used
loggers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]