From 6b07c39cbe4503d73a034e5c5c5894c8b11c9156 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 3 Nov 2022 16:50:45 +0300 Subject: [PATCH] Migrating to unified logger interface --- .gitignore | 1 + go.mod | 2 +- go.sum | 2 ++ push.go | 7 ++++--- 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/go.mod b/go.mod index 095fa57..c552489 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.bit5.ru/backend/huawei_push go 1.13 require ( - git.bit5.ru/backend/colog v1.0.0 git.bit5.ru/backend/errors v1.0.0 golang.org/x/oauth2 v0.1.0 + github.com/go-logr/logr v1.2.3 ) diff --git a/go.sum b/go.sum index ea2ce4b..a470ea4 100644 --- a/go.sum +++ b/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/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-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/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= diff --git a/push.go b/push.go index a7fe56b..1e5b07b 100644 --- a/push.go +++ b/push.go @@ -17,9 +17,10 @@ import ( "net/http" "time" - "git.bit5.ru/backend/colog" "git.bit5.ru/backend/errors" + "golang.org/x/oauth2" + "github.com/go-logr/logr" ) func MakeSendEndpointV1(appId string) string { @@ -38,10 +39,10 @@ type Client struct { cfg ClientConfig ts oauth2.TokenSource 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{ cfg: cfg, ts: ts,