Migrating to unified logger interface
This commit is contained in:
parent
3b517ea495
commit
6b07c39cbe
|
@ -0,0 +1 @@
|
||||||
|
tags
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.bit5.ru/backend/huawei_push
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.bit5.ru/backend/colog v1.0.0
|
|
||||||
git.bit5.ru/backend/errors v1.0.0
|
git.bit5.ru/backend/errors v1.0.0
|
||||||
golang.org/x/oauth2 v0.1.0
|
golang.org/x/oauth2 v0.1.0
|
||||||
|
github.com/go-logr/logr v1.2.3
|
||||||
)
|
)
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -93,6 +93,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
|
||||||
|
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
|
7
push.go
7
push.go
|
@ -17,9 +17,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.bit5.ru/backend/colog"
|
|
||||||
"git.bit5.ru/backend/errors"
|
"git.bit5.ru/backend/errors"
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
|
"github.com/go-logr/logr"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MakeSendEndpointV1(appId string) string {
|
func MakeSendEndpointV1(appId string) string {
|
||||||
|
@ -38,10 +39,10 @@ type Client struct {
|
||||||
cfg ClientConfig
|
cfg ClientConfig
|
||||||
ts oauth2.TokenSource
|
ts oauth2.TokenSource
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
logger *colog.CoLog
|
logger logr.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cfg ClientConfig, ts oauth2.TokenSource, httpClient *http.Client, logger *colog.CoLog) *Client {
|
func NewClient(cfg ClientConfig, ts oauth2.TokenSource, httpClient *http.Client, logger logr.Logger) *Client {
|
||||||
return &Client{
|
return &Client{
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
ts: ts,
|
ts: ts,
|
||||||
|
|
Loading…
Reference in New Issue