refactor(log) aliyun use the same interface name (#2251)

* feat(log): add tencent cls

fix

update

* refactor(log) use the same interface name

* fix(log) tencent toString
pull/2283/head
Germiniku 2 years ago committed by GitHub
parent 11cd43e3c3
commit de2f93fbec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      contrib/log/aliyun/aliyun.go

@ -7,13 +7,13 @@ import (
sls "github.com/aliyun/aliyun-log-go-sdk" sls "github.com/aliyun/aliyun-log-go-sdk"
"github.com/aliyun/aliyun-log-go-sdk/producer" "github.com/aliyun/aliyun-log-go-sdk/producer"
klog "github.com/go-kratos/kratos/v2/log" log "github.com/go-kratos/kratos/v2/log"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
// Log see more detail https://github.com/aliyun/aliyun-log-go-sdk // Log see more detail https://github.com/aliyun/aliyun-log-go-sdk
type Log interface { type Logger interface {
klog.Logger log.Logger
GetProducer() *producer.Producer GetProducer() *producer.Producer
Close() error Close() error
} }
@ -78,7 +78,7 @@ func (a *aliyunLog) Close() error {
return a.producer.Close(5000) return a.producer.Close(5000)
} }
func (a *aliyunLog) Log(level klog.Level, keyvals ...interface{}) error { func (a *aliyunLog) Log(level log.Level, keyvals ...interface{}) error {
buf := level.String() buf := level.String()
levelTitle := "level" levelTitle := "level"
@ -108,7 +108,7 @@ func (a *aliyunLog) Log(level klog.Level, keyvals ...interface{}) error {
} }
// NewAliyunLog new a aliyun logger with options. // NewAliyunLog new a aliyun logger with options.
func NewAliyunLog(options ...Option) Log { func NewAliyunLog(options ...Option) Logger {
opts := defaultOptions() opts := defaultOptions()
for _, o := range options { for _, o := range options {
o(opts) o(opts)

Loading…
Cancel
Save