[VOL-2537] Logging - Implement dynamic log levels in voltha-core

Change-Id: If8e1bee7629d58119b3e08b53a24719020495e28
diff --git a/rw_core/core/grpc_nbi_api_handler.go b/rw_core/core/grpc_nbi_api_handler.go
index 27ebb58..eaf8fac 100755
--- a/rw_core/core/grpc_nbi_api_handler.go
+++ b/rw_core/core/grpc_nbi_api_handler.go
@@ -186,49 +186,6 @@
 	}
 }
 
-// UpdateLogLevel dynamically sets the log level of a given package to level
-func (handler *APIHandler) UpdateLogLevel(ctx context.Context, logging *voltha.Logging) (*empty.Empty, error) {
-	log.Debugw("UpdateLogLevel-request", log.Fields{"package": logging.PackageName, "intval": int(logging.Level)})
-
-	if logging.PackageName == "" {
-		log.SetAllLogLevel(log.LogLevel(logging.Level))
-		log.SetDefaultLogLevel(log.LogLevel(logging.Level))
-	} else if logging.PackageName == "default" {
-		log.SetDefaultLogLevel(log.LogLevel(logging.Level))
-	} else {
-		log.SetPackageLogLevel(logging.PackageName, log.LogLevel(logging.Level))
-	}
-
-	return &empty.Empty{}, nil
-}
-
-// GetLogLevels returns log levels of packages
-func (APIHandler) GetLogLevels(ctx context.Context, in *voltha.LoggingComponent) (*voltha.Loggings, error) {
-	logLevels := &voltha.Loggings{}
-
-	// do the per-package log levels
-	for _, packageName := range log.GetPackageNames() {
-		level, err := log.GetPackageLogLevel(packageName)
-		if err != nil {
-			return &voltha.Loggings{}, err
-		}
-		logLevel := &voltha.Logging{
-			ComponentName: in.ComponentName,
-			PackageName:   packageName,
-			Level:         voltha.LogLevel_Types(level)}
-		logLevels.Items = append(logLevels.Items, logLevel)
-	}
-
-	// now do the default log level
-	logLevel := &voltha.Logging{
-		ComponentName: in.ComponentName,
-		PackageName:   "default",
-		Level:         voltha.LogLevel_Types(log.GetDefaultLogLevel())}
-	logLevels.Items = append(logLevels.Items, logLevel)
-
-	return logLevels, nil
-}
-
 // ListCoreInstances returns details on the running core containers
 func (handler *APIHandler) ListCoreInstances(ctx context.Context, empty *empty.Empty) (*voltha.CoreInstances, error) {
 	log.Debug("ListCoreInstances")
diff --git a/rw_core/main.go b/rw_core/main.go
index e8a7ea6..3068c98 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -29,6 +29,7 @@
 	"github.com/opencord/voltha-go/rw_core/config"
 	c "github.com/opencord/voltha-go/rw_core/core"
 	"github.com/opencord/voltha-go/rw_core/utils"
+	conf "github.com/opencord/voltha-lib-go/v3/pkg/config"
 	"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
 	"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
@@ -113,6 +114,8 @@
 		rw.config.KVStoreTimeout); err != nil {
 		log.Fatal(err)
 	}
+	cm := conf.NewConfigManager(rw.kvClient, rw.config.KVStoreType, rw.config.KVStoreHost, rw.config.KVStorePort, rw.config.KVStoreTimeout)
+	go conf.ProcessLogConfigChange(cm, ctx)
 
 	// Setup KV transaction context
 	if err := c.SetTransactionContext(instanceID,