-
-
Notifications
You must be signed in to change notification settings - Fork 842
/
log_interface.go
45 lines (35 loc) · 1021 Bytes
/
log_interface.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
package logx
import (
"fmt"
"github.com/sirupsen/logrus"
)
// QueueLogger for simple logger.
func QueueLogger() DefaultQueueLogger {
return DefaultQueueLogger{
accessLogger: LogAccess,
errorLogger: LogError,
}
}
// DefaultQueueLogger for queue custom logger
type DefaultQueueLogger struct {
accessLogger *logrus.Logger
errorLogger *logrus.Logger
}
func (l DefaultQueueLogger) Infof(format string, args ...interface{}) {
l.accessLogger.Printf(format, args...)
}
func (l DefaultQueueLogger) Errorf(format string, args ...interface{}) {
l.errorLogger.Printf(format, args...)
}
func (l DefaultQueueLogger) Fatalf(format string, args ...interface{}) {
l.errorLogger.Fatalf(format, args...)
}
func (l DefaultQueueLogger) Info(args ...interface{}) {
l.accessLogger.Println(fmt.Sprint(args...))
}
func (l DefaultQueueLogger) Error(args ...interface{}) {
l.errorLogger.Println(fmt.Sprint(args...))
}
func (l DefaultQueueLogger) Fatal(args ...interface{}) {
l.errorLogger.Println(fmt.Sprint(args...))
}