forked from e-XpertSolutions/f5-auto-uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.go
38 lines (30 loc) · 783 Bytes
/
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
package main
import (
"fmt"
"io"
"log"
)
type logger interface {
Error(v ...interface{})
Errorf(format string, v ...interface{})
Notice(v ...interface{})
Noticef(format string, v ...interface{})
}
type defaultLogger struct {
l *log.Logger
}
func newLogger(w io.Writer) logger {
return &defaultLogger{l: log.New(w, "", log.LstdFlags)}
}
func (dl defaultLogger) Error(v ...interface{}) {
dl.l.Print("[error] ", fmt.Sprint(v...))
}
func (dl defaultLogger) Errorf(format string, v ...interface{}) {
dl.l.Print("[error] ", fmt.Sprintf(format, v...))
}
func (dl defaultLogger) Notice(v ...interface{}) {
dl.l.Print("[notice] ", fmt.Sprint(v...))
}
func (dl defaultLogger) Noticef(format string, v ...interface{}) {
dl.l.Print("[notice] ", fmt.Sprintf(format, v...))
}