-
Notifications
You must be signed in to change notification settings - Fork 1
/
loggers.go
71 lines (52 loc) · 1.76 KB
/
loggers.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main
import (
"fmt"
"pubsubroller/subscription"
"pubsubroller/topic"
)
// topic
type createTopicsLogger struct{}
func (_ createTopicsLogger) Initialized() {
fmt.Println("Start creating topics...")
}
func (_ createTopicsLogger) Each(topic topic.Topic) {
fmt.Printf("Topic created: %s\n", topic.Name)
}
func (_ createTopicsLogger) Finalized(counter countable) {
done, skipped := counter.Result()
fmt.Printf("Topics created: %d, skipped: %d\n", done, skipped)
}
type deleteTopicsLogger struct{}
func (_ deleteTopicsLogger) Initialized() {
fmt.Println("Start deleting topics...")
}
func (_ deleteTopicsLogger) Each(topic topic.Topic) {
fmt.Printf("Topic deleted: %s\n", topic.Name)
}
func (_ deleteTopicsLogger) Finalized(counter countable) {
done, skipped := counter.Result()
fmt.Printf("Topics deleted: %d, skipped: %d\n", done, skipped)
}
// subscription
type createSubscriptionsLogger struct{}
func (_ createSubscriptionsLogger) Initialized() {
fmt.Println("Start creating subscriptions...")
}
func (_ createSubscriptionsLogger) Each(subscription subscription.Subscription) {
fmt.Printf("Subscription creatd: %s\n", subscription.Name)
}
func (_ createSubscriptionsLogger) Finalized(counter countable) {
done, skipped := counter.Result()
fmt.Printf("Subscriptions created: %d, skipped: %d\n", done, skipped)
}
type deleteSubscriptionLogger struct{}
func (_ deleteSubscriptionLogger) Initialized() {
fmt.Println("Start deleting subscriptions...")
}
func (_ deleteSubscriptionLogger) Each(subscription subscription.Subscription) {
fmt.Printf("Subscription deleted: %s\n", subscription.Name)
}
func (_ deleteSubscriptionLogger) Finalized(counter countable) {
done, skipped := counter.Result()
fmt.Printf("Subscriptions deleted: %d, skipped: %d\n", done, skipped)
}