etcdserver/stats: use leveled log

release-2.1
Xiang Li 2015-06-11 09:40:44 -07:00
parent cf7cb2b8a9
commit f013a627a4
2 changed files with 7 additions and 2 deletions

View File

@ -16,7 +16,6 @@ package stats
import ( import (
"encoding/json" "encoding/json"
"log"
"math" "math"
"sync" "sync"
"time" "time"
@ -47,7 +46,7 @@ func (ls *LeaderStats) JSON() []byte {
b, err := json.Marshal(stats) b, err := json.Marshal(stats)
// TODO(jonboulle): appropriate error handling? // TODO(jonboulle): appropriate error handling?
if err != nil { if err != nil {
log.Printf("stats: error marshalling leader stats: %v", err) plog.Errorf("error marshalling leader stats (%v)", err)
} }
return b return b
} }

View File

@ -14,6 +14,12 @@
package stats package stats
import "github.com/coreos/pkg/capnslog"
var (
plog = capnslog.NewPackageLogger("github.com/coreos/etcd/etcdserver", "stats")
)
type Stats interface { type Stats interface {
// SelfStats returns the struct representing statistics of this server // SelfStats returns the struct representing statistics of this server
SelfStats() []byte SelfStats() []byte