-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlogger.go
41 lines (34 loc) · 1011 Bytes
/
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
36
37
38
39
40
41
package oauth2
import (
"context"
"fmt"
)
// Logger logger
type Logger interface {
// Debugf 测试
Debugf(ctx context.Context, format string, args ...interface{})
// Debugln 测试
Debugln(ctx context.Context, args ...interface{})
// Errorf 错误
Errorf(ctx context.Context, format string, args ...interface{})
// Errorln 错误
Errorln(ctx context.Context, args ...interface{})
}
// DefaultLogger ...
type DefaultLogger struct{}
// Debugf ...
func (*DefaultLogger) Debugf(_ context.Context, format string, args ...interface{}) {
fmt.Printf("OAuth2 [DEBUG] "+format+"\n", args...)
}
// Debugln ...
func (*DefaultLogger) Debugln(_ context.Context, args ...interface{}) {
fmt.Println("OAuth2 [DEBUG] ", args)
}
// Errorf ...
func (*DefaultLogger) Errorf(_ context.Context, format string, args ...interface{}) {
fmt.Printf("OAuth2 [ERROR] "+format+"\n", args...)
}
// Errorln ...
func (*DefaultLogger) Errorln(_ context.Context, args ...interface{}) {
fmt.Println("OAuth2 [ERROR] ", args)
}