Skip to content

Commit

Permalink
remove VerboseLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Apr 17, 2017
1 parent 36041d3 commit ff89e12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 7 additions & 4 deletions grpclog/grpclog.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import "os"
var logger = newLoggerV2()

// V reports whether verbosity level l is at least the requested verbose level.
func V(l VerboseLevel) bool {
func V(l int) bool {
return logger.V(l)
}

Expand Down Expand Up @@ -87,19 +87,22 @@ func Errorln(args ...interface{}) {
logger.Errorln(args...)
}

// Fatal is equivalent to Info() followed by a call to os.Exit() with a non-zero exit code.
// Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print.
// It calls os.Exit() with exit code 1.
func Fatal(args ...interface{}) {
logger.Fatal(args...)
os.Exit(1)
}

// Fatalf is equivalent to Infof() followed by a call to os.Exit() with a non-zero exit code.
// Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf.
// It calles os.Exit() with exit code 1.
func Fatalf(format string, args ...interface{}) {
logger.Fatalf(format, args...)
os.Exit(1)
}

// Fatalln is equivalent to Infoln() followed by a call to os.Exit()) with a non-zero exit code.
// Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println.
// It calle os.Exit()) with exit code 1.
func Fatalln(args ...interface{}) {
logger.Fatalln(args...)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion grpclog/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (g *loggerWrapper) Errorf(format string, args ...interface{}) {
g.Logger.Printf(format, args...)
}

func (g *loggerWrapper) V(l VerboseLevel) bool {
func (g *loggerWrapper) V(l int) bool {
// Returns true for all verbose level.
return true
}
7 changes: 2 additions & 5 deletions grpclog/loggerv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ import (
"os"
)

// VerboseLevel identifies the verbose level used in grpclog.V() function.
type VerboseLevel int32

// LoggerV2 does underlying logging work for grpclog.
type LoggerV2 interface {
// Info logs to INFO log. Arguments are handled in the manner of fmt.Print.
Expand Down Expand Up @@ -76,7 +73,7 @@ type LoggerV2 interface {
// This function should call os.Exit() with a non-zero exit code.
Fatalf(format string, args ...interface{})
// V reports whether verbosity level l is at least the requested verbose level.
V(l VerboseLevel) bool
V(l int) bool
}

// SetLoggerV2 sets logger that is used in grpc to a V2 logger.
Expand Down Expand Up @@ -178,7 +175,7 @@ func (g *loggerT) Fatalf(format string, args ...interface{}) {
g.m[fatalLog].Fatalf(format, args...)
}

func (g *loggerT) V(l VerboseLevel) bool {
func (g *loggerT) V(l int) bool {
// Returns true for all verbose level.
// TODO support verbose level in the default logger.
return true
Expand Down

0 comments on commit ff89e12

Please sign in to comment.