mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-16 02:47:03 +02:00
feat: add config log (#2060)
This commit is contained in:
parent
503ec03f37
commit
c01fd054ec
@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -45,9 +47,11 @@ func (r *reader) Merge(kvs ...*KeyValue) error {
|
||||
for _, kv := range kvs {
|
||||
next := make(map[string]interface{})
|
||||
if err := r.opts.decoder(kv, next); err != nil {
|
||||
_ = r.opts.logger.Log(log.LevelError, fmt.Sprintf("config decode error, err: %v, key: %s, value: %s", err, kv.Key, string(kv.Value)))
|
||||
return err
|
||||
}
|
||||
if err := mergo.Map(&merged, convertMap(next), mergo.WithOverride); err != nil {
|
||||
_ = r.opts.logger.Log(log.LevelError, fmt.Sprintf("config merge error, err: %v, key: %s, value: %s", err, kv.Key, string(kv.Value)))
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user