@@ -43,29 +43,29 @@ import (
43
43
var PLACEHOLDER = regexp .MustCompile ("{(\\ d)}" )
44
44
45
45
type Logger interface {
46
- Fprintln (w io.Writer , format string , a ... interface {})
47
- Println (format string , a ... interface {})
46
+ Fprintln (w io.Writer , level string , format string , a ... interface {})
47
+ Println (level string , format string , a ... interface {})
48
48
Name () string
49
49
}
50
50
51
51
type NoopLogger struct {}
52
52
53
- func (s NoopLogger ) Fprintln (w io.Writer , format string , a ... interface {}) {}
53
+ func (s NoopLogger ) Fprintln (w io.Writer , level string , format string , a ... interface {}) {}
54
54
55
- func (s NoopLogger ) Println (format string , a ... interface {}) {}
55
+ func (s NoopLogger ) Println (level string , format string , a ... interface {}) {}
56
56
57
57
func (s NoopLogger ) Name () string {
58
58
return "noop"
59
59
}
60
60
61
61
type HumanLogger struct {}
62
62
63
- func (s HumanLogger ) Fprintln (w io.Writer , format string , a ... interface {}) {
63
+ func (s HumanLogger ) Fprintln (w io.Writer , level string , format string , a ... interface {}) {
64
64
fmt .Fprintln (w , Format (format , a ... ))
65
65
}
66
66
67
- func (s HumanLogger ) Println (format string , a ... interface {}) {
68
- s .Fprintln (os .Stdout , Format (format , a ... ))
67
+ func (s HumanLogger ) Println (level string , format string , a ... interface {}) {
68
+ s .Fprintln (os .Stdout , level , Format (format , a ... ))
69
69
}
70
70
71
71
func (s HumanLogger ) Name () string {
@@ -74,24 +74,24 @@ func (s HumanLogger) Name() string {
74
74
75
75
type MachineLogger struct {}
76
76
77
- func (s MachineLogger ) printWithoutFormatting (w io.Writer , format string , a []interface {}) {
77
+ func (s MachineLogger ) printWithoutFormatting (w io.Writer , level string , format string , a []interface {}) {
78
78
a = append ([]interface {}(nil ), a ... )
79
79
for idx , value := range a {
80
80
typeof := reflect .Indirect (reflect .ValueOf (value )).Kind ()
81
81
if typeof == reflect .String {
82
82
a [idx ] = url .QueryEscape (value .(string ))
83
83
}
84
84
}
85
- fmt .Fprintf (w , "===%s ||| %s" , format , a )
85
+ fmt .Fprintf (w , "===%s ||| %s ||| %s" , level , format , a )
86
86
fmt .Fprintln (w )
87
87
}
88
88
89
- func (s MachineLogger ) Fprintln (w io.Writer , format string , a ... interface {}) {
90
- s .printWithoutFormatting (w , format , a )
89
+ func (s MachineLogger ) Fprintln (w io.Writer , level string , format string , a ... interface {}) {
90
+ s .printWithoutFormatting (w , level , format , a )
91
91
}
92
92
93
- func (s MachineLogger ) Println (format string , a ... interface {}) {
94
- s .printWithoutFormatting (os .Stdout , format , a )
93
+ func (s MachineLogger ) Println (level string , format string , a ... interface {}) {
94
+ s .printWithoutFormatting (os .Stdout , level , format , a )
95
95
}
96
96
97
97
func (s MachineLogger ) Name () string {
0 commit comments