-
Notifications
You must be signed in to change notification settings - Fork 23
/
logger.go
41 lines (34 loc) · 855 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
package fakes
import "fmt"
type Logger struct {
PrintfCall struct {
CallCount int
Receives struct {
Message string
Arguments []interface{}
}
Messages []string
}
PromptWithDetailsCall struct {
CallCount int
Receives struct {
Type string
Name string
}
Returns struct {
Proceed bool
}
}
}
func (l *Logger) Printf(message string, a ...interface{}) {
l.PrintfCall.CallCount++
l.PrintfCall.Receives.Message = message
l.PrintfCall.Receives.Arguments = a
l.PrintfCall.Messages = append(l.PrintfCall.Messages, fmt.Sprintf(message, a...))
}
func (l *Logger) PromptWithDetails(resourceType, resourceName string) bool {
l.PromptWithDetailsCall.CallCount++
l.PromptWithDetailsCall.Receives.Type = resourceType
l.PromptWithDetailsCall.Receives.Name = resourceName
return l.PromptWithDetailsCall.Returns.Proceed
}