-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
47 lines (33 loc) · 872 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
42
43
44
45
46
47
package captchasolve
import (
"log"
)
type Logger interface {
Debug(format string, args ...any)
Info(format string, args ...any)
Warn(format string, args ...any)
Error(format string, args ...any)
}
type logger struct{}
func NewLogger() Logger {
return &logger{}
}
func (logger) Debug(_ string, _ ...any) {}
func (logger) Info(format string, args ...any) {
log.Printf(format+"\n", args...)
}
func (logger) Warn(format string, args ...any) {
log.Printf(format+"\n", args...)
}
func (logger) Error(format string, args ...any) {
log.Printf(format+"\n", args...)
}
type silentLogger struct {
}
func NewSilentLogger() Logger {
return &silentLogger{}
}
func (s silentLogger) Debug(_ string, _ ...any) {}
func (s silentLogger) Info(_ string, _ ...any) {}
func (s silentLogger) Warn(_ string, _ ...any) {}
func (s silentLogger) Error(_ string, _ ...any) {}