mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #24745 from daehyeok/logrus
Refactoring for logrus formatting
This commit is contained in:
commit
170abb5f7c
5 changed files with 13 additions and 13 deletions
|
@ -7,7 +7,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/pkg/discovery"
|
"github.com/docker/docker/pkg/discovery"
|
||||||
|
|
||||||
// Register the libkv backends for discovery.
|
// Register the libkv backends for discovery.
|
||||||
|
@ -115,7 +115,7 @@ func (d *daemonDiscoveryReloader) advertiseHeartbeat(address string) {
|
||||||
select {
|
select {
|
||||||
case <-d.ticker.C:
|
case <-d.ticker.C:
|
||||||
if err := d.backend.Register(address); err != nil {
|
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 {
|
} else {
|
||||||
if !ready {
|
if !ready {
|
||||||
close(d.readyCh)
|
close(d.readyCh)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -54,7 +54,7 @@ func Mounted(fsType FsMagic, mountPath string) (bool, error) {
|
||||||
// on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ]
|
// 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) ||
|
if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) ||
|
||||||
(buf.f_basetype[3] != 0) {
|
(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))
|
C.free(unsafe.Pointer(buf))
|
||||||
return false, ErrPrerequisites
|
return false, ErrPrerequisites
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"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 ... ]
|
// 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) ||
|
if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) ||
|
||||||
(buf.f_basetype[3] != 0) {
|
(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))
|
C.free(unsafe.Pointer(buf))
|
||||||
return graphdriver.ErrPrerequisites
|
return graphdriver.ErrPrerequisites
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -21,7 +21,7 @@ func Register(scheme string, d Backend) error {
|
||||||
if _, exists := backends[scheme]; exists {
|
if _, exists := backends[scheme]; exists {
|
||||||
return fmt.Errorf("scheme already registered %s", scheme)
|
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
|
backends[scheme] = d
|
||||||
return nil
|
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) {
|
func New(rawurl string, heartbeat time.Duration, ttl time.Duration, clusterOpts map[string]string) (Backend, error) {
|
||||||
scheme, uri := parse(rawurl)
|
scheme, uri := parse(rawurl)
|
||||||
if backend, exists := backends[scheme]; exists {
|
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)
|
err := backend.Initialize(uri, heartbeat, ttl, clusterOpts)
|
||||||
return backend, err
|
return backend, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/pkg/discovery"
|
"github.com/docker/docker/pkg/discovery"
|
||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/docker/go-connections/tlsconfig"
|
||||||
"github.com/docker/libkv"
|
"github.com/docker/libkv"
|
||||||
|
@ -73,7 +73,7 @@ func (s *Discovery) Initialize(uris string, heartbeat time.Duration, ttl time.Du
|
||||||
|
|
||||||
var config *store.Config
|
var config *store.Config
|
||||||
if clusterOpts["kv.cacertfile"] != "" && clusterOpts["kv.certfile"] != "" && clusterOpts["kv.keyfile"] != "" {
|
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{
|
tlsConfig, err := tlsconfig.Client(tlsconfig.Options{
|
||||||
CAFile: clusterOpts["kv.cacertfile"],
|
CAFile: clusterOpts["kv.cacertfile"],
|
||||||
CertFile: clusterOpts["kv.certfile"],
|
CertFile: clusterOpts["kv.certfile"],
|
||||||
|
@ -93,7 +93,7 @@ func (s *Discovery) Initialize(uris string, heartbeat time.Duration, ttl time.Du
|
||||||
TLS: tlsConfig,
|
TLS: tlsConfig,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Info("Initializing discovery without TLS")
|
logrus.Infof("Initializing discovery without TLS")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new store, will ignore options given
|
// 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
|
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`.
|
// Convert `KVPair` into `discovery.Entry`.
|
||||||
addrs := make([]string, len(pairs))
|
addrs := make([]string, len(pairs))
|
||||||
|
|
Loading…
Add table
Reference in a new issue