From 82e9b4cd9ad968f747e852b24332c7c2ed001eea Mon Sep 17 00:00:00 2001 From: zhenghe3119 Date: Thu, 22 Aug 2019 17:32:59 +0800 Subject: [PATCH 1/3] bump agollo to v4.1.3 --- go.mod | 2 +- go.sum | 2 ++ sconf/center/apollo.go | 2 +- sconf/center/change.go | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cd814ad..f4546b4 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/shawnfeng/sutil require ( github.com/BurntSushi/toml v0.3.1 // indirect - github.com/ZhengHe-MD/agollo v0.0.0-20190716115826-871879c67d2c + github.com/ZhengHe-MD/agollo/v4 v4.1.3 github.com/ZhengHe-MD/properties v0.2.1 github.com/bitly/go-simplejson v0.4.4-0.20140701141959-3378bdcb5ceb github.com/coreos/etcd v3.0.0-beta.0.0.20160712024141-cc26f2c8892e+incompatible diff --git a/go.sum b/go.sum index 157c394..b5f4adf 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,8 @@ github.com/ZhengHe-MD/agollo v0.0.0-20190716115826-871879c67d2c h1:JqNcZdgvS1L0D github.com/ZhengHe-MD/agollo v0.0.0-20190716115826-871879c67d2c/go.mod h1:Hs1VYbuOoVlDPOMlZawvwpN7eAqDOQUFG3Lxcne0SBo= github.com/ZhengHe-MD/agollo v2.1.0+incompatible h1:NqugIJRTEPNLBtzg3TkM2rfUnpwNRgkhy0Mhk3yJ0Es= github.com/ZhengHe-MD/agollo v2.1.0+incompatible/go.mod h1:Hs1VYbuOoVlDPOMlZawvwpN7eAqDOQUFG3Lxcne0SBo= +github.com/ZhengHe-MD/agollo/v4 v4.1.3 h1:qsJ6oWrb+tYp16RUS2X3Ez6yE3f55y1rYlxdcRWvMkQ= +github.com/ZhengHe-MD/agollo/v4 v4.1.3/go.mod h1:Cze1dOFujMfuqY5mZWzz1vvJ0ZdpDQ77PC5m2J/qv+4= github.com/ZhengHe-MD/properties v0.0.1 h1:o/BdossbmWdoD0T5jhEW3ty77q1Yy106uefvV1GDPQc= github.com/ZhengHe-MD/properties v0.0.1/go.mod h1:6d7Dapy6sSqC/QRwv8HTZ7h6yxvYQsyIcKBdYJJbyLE= github.com/ZhengHe-MD/properties v0.0.2 h1:+ZlfMUFN0rrTEjSsSvdZmwwvry6tHVq036k5KIsbYuM= diff --git a/sconf/center/apollo.go b/sconf/center/apollo.go index 7b34328..2230493 100644 --- a/sconf/center/apollo.go +++ b/sconf/center/apollo.go @@ -2,7 +2,7 @@ package center import ( "context" - "github.com/ZhengHe-MD/agollo" + "github.com/ZhengHe-MD/agollo/v4" "github.com/ZhengHe-MD/properties" "github.com/opentracing/opentracing-go" "github.com/shawnfeng/sutil/slog/slog" diff --git a/sconf/center/change.go b/sconf/center/change.go index 35605f3..191e8dd 100644 --- a/sconf/center/change.go +++ b/sconf/center/change.go @@ -1,7 +1,7 @@ package center import ( - "github.com/ZhengHe-MD/agollo" + "github.com/ZhengHe-MD/agollo/v4" "github.com/pkg/errors" ) From 2d1d4bc302de39270616974d11d5de246847a589 Mon Sep 17 00:00:00 2001 From: zhenghe3119 Date: Wed, 28 Aug 2019 14:54:49 +0800 Subject: [PATCH 2/3] slog: fix Logger.Printf level --- slog/slog/slog.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slog/slog/slog.go b/slog/slog/slog.go index 6845693..5fdb9cf 100644 --- a/slog/slog/slog.go +++ b/slog/slog/slog.go @@ -102,5 +102,5 @@ func GetLogger() *Logger { } func (m *Logger) Printf(format string, v ...interface{}) { - Errorf(context.Background(), format, v...) + Infof(context.Background(), format, v...) } From 4e605895edbc50fbfaa18ad8eac68f00b687eb4c Mon Sep 17 00:00:00 2001 From: zhenghe3119 Date: Tue, 3 Sep 2019 10:37:56 +0800 Subject: [PATCH 3/3] use apollo as default configer --- cache/redisext/redisext.go | 9 ++++++++- cache/value/value.go | 9 ++++++++- mq/interface.go | 10 ++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/cache/redisext/redisext.go b/cache/redisext/redisext.go index 7f30f61..69cbbb9 100644 --- a/cache/redisext/redisext.go +++ b/cache/redisext/redisext.go @@ -294,5 +294,12 @@ func WatchUpdate(ctx context.Context) { } func init() { - _ = SetConfiger(context.Background(), cache.ConfigerTypeSimple) + fun := "redisext.init -->" + ctx := context.Background() + err := SetConfiger(ctx, cache.ConfigerTypeApollo) + if err != nil { + slog.Errorf(ctx, "%s set redisext configer:%v err:%v", fun, cache.ConfigerTypeApollo, err) + } else { + slog.Infof(ctx, "%s redisext configer:%v been set", fun, cache.ConfigerTypeApollo) + } } diff --git a/cache/value/value.go b/cache/value/value.go index 891c6ab..d2edcee 100644 --- a/cache/value/value.go +++ b/cache/value/value.go @@ -239,6 +239,13 @@ func WatchUpdate(ctx context.Context) { } func init() { - _ = SetConfiger(context.Background(), cache.ConfigerTypeSimple) + fun := "value.init -->" + ctx := context.Background() + err := SetConfiger(ctx, cache.ConfigerTypeApollo) + if err != nil { + slog.Errorf(ctx, "%s set cache configer:%v err:%v", fun, cache.ConfigerTypeApollo, err) + } else { + slog.Infof(ctx, "%s cache configer:%v been set", fun, cache.ConfigerTypeApollo) + } } diff --git a/mq/interface.go b/mq/interface.go index e5d0778..7557afb 100644 --- a/mq/interface.go +++ b/mq/interface.go @@ -283,6 +283,12 @@ func Close() { } func init() { - // set default config type to simple - _ = SetConfiger(context.Background(), ConfigerTypeSimple) + fun := "mq.init -->" + ctx := context.Background() + err := SetConfiger(ctx, ConfigerTypeApollo) + if err != nil { + slog.Errorf(ctx, "%s set mq configer:%v err:%v", fun, ConfigerTypeApollo, err) + } else { + slog.Infof(ctx, "%s mq configer:%v been set", fun, ConfigerTypeApollo) + } }