Add logger interface and stop relying on Logrus directly

This commit is contained in:
Mark Sagi-Kazar
2019-02-22 13:19:23 +01:00
parent ca66289077
commit be581fa7ff
38 changed files with 203 additions and 133 deletions

View File

@@ -24,9 +24,9 @@ import (
"github.com/ghodss/yaml"
"github.com/gtank/cryptopasta"
"github.com/sirupsen/logrus"
"golang.org/x/net/http2"
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/storage"
"github.com/dexidp/dex/storage/kubernetes/k8sapi"
)
@@ -35,7 +35,7 @@ type client struct {
client *http.Client
baseURL string
namespace string
logger logrus.FieldLogger
logger log.Logger
// Hash function to map IDs (which could span a large range) to Kubernetes names.
// While this is not currently upgradable, it could be in the future.
@@ -253,7 +253,7 @@ func (c *client) put(resource, name string, v interface{}) error {
return checkHTTPErr(resp, http.StatusOK)
}
func newClient(cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace string, logger logrus.FieldLogger, useTPR bool) (*client, error) {
func newClient(cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace string, logger log.Logger, useTPR bool) (*client, error) {
tlsConfig := cryptopasta.DefaultTLSConfig()
data := func(b string, file string) ([]byte, error) {
if b != "" {