-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.go
40 lines (31 loc) · 1 KB
/
log.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
36
37
38
39
40
package sladder
import (
"io/ioutil"
"log"
)
type discardLogger struct {
*log.Logger
}
func (l *discardLogger) Warn(v ...interface{}) {}
func (l *discardLogger) Warnf(format string, v ...interface{}) {}
func (l *discardLogger) Fatal(v ...interface{}) {}
func (l *discardLogger) Fatalf(format string, v ...interface{}) {}
func (l *discardLogger) Error(v ...interface{}) {}
func (l *discardLogger) Errorf(format string, v ...interface{}) {}
var (
// DefaultLogger implements defaule logging behaviours.
DefaultLogger = &discardLogger{Logger: log.New(ioutil.Discard, "", 0)}
)
// Logger is logging abstraction.
type Logger interface {
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Error(v ...interface{})
Errorf(format string, v ...interface{})
Panic(v ...interface{})
Panicf(format string, v ...interface{})
Print(v ...interface{})
Printf(format string, v ...interface{})
Warn(v ...interface{})
Warnf(format string, v ...interface{})
}