pbacsko commented on code in PR #611:
URL: https://github.com/apache/yunikorn-k8shim/pull/611#discussion_r1230857285


##########
pkg/log/logger.go:
##########
@@ -82,3 +171,87 @@ func GetZapConfigs() *zap.Config {
        _ = Logger()
        return zapConfigs
 }
+
+// SetDefaultLogger allows customization of the default logger
+func SetDefaultLogger(handle *LoggerHandle) {
+       once.Do(initLogger)
+       defaultLogger.Store(handle)
+}
+
+// UpdateLoggingConfig is used to reconfigure logging.
+// This uses config keys of the form log.{logger}.level={level}.
+// The default level is set by log.level={level}
+func UpdateLoggingConfig(config map[string]string) {
+       once.Do(initLogger)
+       initLoggingConfig(config)
+}
+
+func initLoggingConfig(config map[string]string) {
+       levelMap := make(map[string]zapcore.Level)
+       levelMap[""] = zapcore.InfoLevel

Review Comment:
   Can we have a constant for `""`, it's not entirely clear what it represents. 
I guess it's a default level, but a naming would help.



##########
pkg/log/logger.go:
##########
@@ -82,3 +171,87 @@ func GetZapConfigs() *zap.Config {
        _ = Logger()
        return zapConfigs
 }
+
+// SetDefaultLogger allows customization of the default logger
+func SetDefaultLogger(handle *LoggerHandle) {
+       once.Do(initLogger)
+       defaultLogger.Store(handle)
+}
+
+// UpdateLoggingConfig is used to reconfigure logging.
+// This uses config keys of the form log.{logger}.level={level}.
+// The default level is set by log.level={level}
+func UpdateLoggingConfig(config map[string]string) {
+       once.Do(initLogger)
+       initLoggingConfig(config)
+}
+
+func initLoggingConfig(config map[string]string) {
+       levelMap := make(map[string]zapcore.Level)
+       levelMap[""] = zapcore.InfoLevel

Review Comment:
   Can we have a constant for `""`? It's not entirely clear what it represents. 
I guess it's a default level, but a naming would help.



-- 
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]

Reply via email to