mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Switch from golang log to coreos/go-log
This commit is contained in:
parent
951d467917
commit
a121cbb721
29
util.go
29
util.go
@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -15,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/web"
|
||||
"github.com/coreos/go-log/log"
|
||||
)
|
||||
|
||||
//--------------------------------------
|
||||
@ -141,41 +141,40 @@ func check(err error) {
|
||||
var logger *log.Logger
|
||||
|
||||
func init() {
|
||||
logger = log.New(os.Stdout, "[etcd] ", log.Lmicroseconds)
|
||||
logger = log.New("etcd", false,
|
||||
log.CombinedSink(os.Stdout, "[%s] %s %-9s | %s\n", []string{"prefix", "time", "priority", "message"}))
|
||||
}
|
||||
|
||||
func infof(msg string, v ...interface{}) {
|
||||
logger.Printf("INFO "+msg+"\n", v...)
|
||||
func infof(format string, v ...interface{}) {
|
||||
logger.Infof(format, v...)
|
||||
}
|
||||
|
||||
func debugf(msg string, v ...interface{}) {
|
||||
func debugf(format string, v ...interface{}) {
|
||||
if verbose {
|
||||
logger.Printf("DEBUG "+msg+"\n", v...)
|
||||
logger.Debugf(format, v...)
|
||||
}
|
||||
}
|
||||
|
||||
func debug(v ...interface{}) {
|
||||
if verbose {
|
||||
logger.Println("DEBUG " + fmt.Sprint(v...))
|
||||
logger.Debug(v...)
|
||||
}
|
||||
}
|
||||
|
||||
func warnf(msg string, v ...interface{}) {
|
||||
logger.Printf("WARN "+msg+"\n", v...)
|
||||
func warnf(format string, v ...interface{}) {
|
||||
logger.Warningf(format, v...)
|
||||
}
|
||||
|
||||
func warn(v ...interface{}) {
|
||||
logger.Println("WARN " + fmt.Sprint(v...))
|
||||
logger.Warning(v...)
|
||||
}
|
||||
|
||||
func fatalf(msg string, v ...interface{}) {
|
||||
logger.Printf("FATAL "+msg+"\n", v...)
|
||||
os.Exit(1)
|
||||
func fatalf(format string, v ...interface{}) {
|
||||
logger.Fatalf(format, v...)
|
||||
}
|
||||
|
||||
func fatal(v ...interface{}) {
|
||||
logger.Println("FATAL " + fmt.Sprint(v...))
|
||||
os.Exit(1)
|
||||
logger.Fatalln(v...)
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user