/
log.go
46 lines (38 loc) · 1.18 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
41
42
43
44
45
46
package dl
import (
"fmt"
"io"
"os"
"github.com/go-logr/logr"
)
// Logger is a struct for preserving *logr.Logger.
type Logger struct {
*logr.Logger
}
// NewLogger wraps logr.Logger.
func NewLogger(l *logr.Logger) *Logger {
return &Logger{
l,
}
}
// Fprintf formats according to a format specifier and writes to w.
// Arguments are handled in the manner of fmt.FPrintf.
func Fprintf(w io.Writer, format string, v ...interface{}) (int, error) {
return fmt.Fprintf(w, format, v...)
}
// Fprintln formats using the default formats for its operands and writes to w.
// Spaces are always added between operands and a newline is appended.
// Arguments are handled in the manner of fmt.FPrintln.
func Fprintln(w io.Writer, v ...interface{}) (int, error) {
return fmt.Fprintln(w, v...)
}
// Printf calls Fprintf to print to the standard logger.
// Arguments are handled in the manner of fmt.Printf.
func Printf(format string, v ...interface{}) (int, error) {
return Fprintf(os.Stderr, format, v...)
}
// Println calls Fprintln to print to the standard logger.
// Arguments are handled in the manner of fmt.Printf.
func Println(v ...interface{}) (int, error) {
return Fprintln(os.Stderr, v...)
}