Merge pull request #24745 from daehyeok/logrus

Refactoring for logrus formatting
This commit is contained in:
Alexander Morozov 2016-07-28 16:50:19 -07:00 committed by GitHub
commit 170abb5f7c
5 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@ import (
"strconv"
"time"
log "github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/discovery"
// Register the libkv backends for discovery.
@ -115,7 +115,7 @@ func (d *daemonDiscoveryReloader) advertiseHeartbeat(address string) {
select {
case <-d.ticker.C:
if err := d.backend.Register(address); err != nil {
log.Warnf("Registering as %q in discovery failed: %v", address, err)
logrus.Warnf("Registering as %q in discovery failed: %v", address, err)
} else {
if !ready {
close(d.readyCh)

View File

@ -19,7 +19,7 @@ import (
"path/filepath"
"unsafe"
log "github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus"
)
const (
@ -54,7 +54,7 @@ func Mounted(fsType FsMagic, mountPath string) (bool, error) {
// on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ]
if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) ||
(buf.f_basetype[3] != 0) {
log.Debugf("[zfs] no zfs dataset found for rootdir '%s'", mountPath)
logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", mountPath)
C.free(unsafe.Pointer(buf))
return false, ErrPrerequisites
}

View File

@ -20,7 +20,7 @@ import (
"strings"
"unsafe"
log "github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
)
@ -32,7 +32,7 @@ func checkRootdirFs(rootdir string) error {
// on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ]
if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) ||
(buf.f_basetype[3] != 0) {
log.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
C.free(unsafe.Pointer(buf))
return graphdriver.ErrPrerequisites
}

View File

@ -6,7 +6,7 @@ import (
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus"
)
var (
@ -21,7 +21,7 @@ func Register(scheme string, d Backend) error {
if _, exists := backends[scheme]; exists {
return fmt.Errorf("scheme already registered %s", scheme)
}
log.WithField("name", scheme).Debug("Registering discovery service")
logrus.WithField("name", scheme).Debugf("Registering discovery service")
backends[scheme] = d
return nil
}
@ -98,7 +98,7 @@ func ParseAdvertise(advertise string) (string, error) {
func New(rawurl string, heartbeat time.Duration, ttl time.Duration, clusterOpts map[string]string) (Backend, error) {
scheme, uri := parse(rawurl)
if backend, exists := backends[scheme]; exists {
log.WithFields(log.Fields{"name": scheme, "uri": uri}).Debug("Initializing discovery service")
logrus.WithFields(logrus.Fields{"name": scheme, "uri": uri}).Debugf("Initializing discovery service")
err := backend.Initialize(uri, heartbeat, ttl, clusterOpts)
return backend, err
}

View File

@ -6,7 +6,7 @@ import (
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/discovery"
"github.com/docker/go-connections/tlsconfig"
"github.com/docker/libkv"
@ -73,7 +73,7 @@ func (s *Discovery) Initialize(uris string, heartbeat time.Duration, ttl time.Du
var config *store.Config
if clusterOpts["kv.cacertfile"] != "" && clusterOpts["kv.certfile"] != "" && clusterOpts["kv.keyfile"] != "" {
log.Info("Initializing discovery with TLS")
logrus.Infof("Initializing discovery with TLS")
tlsConfig, err := tlsconfig.Client(tlsconfig.Options{
CAFile: clusterOpts["kv.cacertfile"],
CertFile: clusterOpts["kv.certfile"],
@ -93,7 +93,7 @@ func (s *Discovery) Initialize(uris string, heartbeat time.Duration, ttl time.Du
TLS: tlsConfig,
}
} else {
log.Info("Initializing discovery without TLS")
logrus.Infof("Initializing discovery without TLS")
}
// Creates a new store, will ignore options given
@ -112,7 +112,7 @@ func (s *Discovery) watchOnce(stopCh <-chan struct{}, watchCh <-chan []*store.KV
return true
}
log.WithField("discovery", s.backend).Debugf("Watch triggered with %d nodes", len(pairs))
logrus.WithField("discovery", s.backend).Debugf("Watch triggered with %d nodes", len(pairs))
// Convert `KVPair` into `discovery.Entry`.
addrs := make([]string, len(pairs))