forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console_logger.go
35 lines (27 loc) · 905 Bytes
/
console_logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package logutil
import (
"fmt"
log "github.com/golang/glog"
)
// ConsoleLogger is a Logger that uses glog directly to log, at the right level.
type ConsoleLogger struct{}
// NewConsoleLogger returns a simple ConsoleLogger
func NewConsoleLogger() ConsoleLogger {
return ConsoleLogger{}
}
// Infof is part of the Logger interface
func (cl ConsoleLogger) Infof(format string, v ...interface{}) {
log.InfoDepth(2, fmt.Sprintf(format, v...))
}
// Warningf is part of the Logger interface
func (cl ConsoleLogger) Warningf(format string, v ...interface{}) {
log.WarningDepth(2, fmt.Sprintf(format, v...))
}
// Errorf is part of the Logger interface
func (cl ConsoleLogger) Errorf(format string, v ...interface{}) {
log.ErrorDepth(2, fmt.Sprintf(format, v...))
}
// Printf is part of the Logger interface
func (cl ConsoleLogger) Printf(format string, v ...interface{}) {
fmt.Printf(format, v...)
}