forked from Unleash/unleash-client-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
debuglistener.go
40 lines (32 loc) · 1.14 KB
/
debuglistener.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
package unleash
import (
"fmt"
)
// DebugListener is an implementation of all of the listener interfaces that simply logs
// debug info to stdout. It is meant for debugging purposes and an example of implementing
// the listener interfaces.
type DebugListener struct{}
// OnError prints out errors.
func (l DebugListener) OnError(err error) {
fmt.Printf("ERROR: %s\n", err.Error())
}
// OnWarning prints out warning.
func (l DebugListener) OnWarning(warning error) {
fmt.Printf("WARNING: %s\n", warning.Error())
}
// OnReady prints to the console when the repository is ready.
func (l DebugListener) OnReady() {
fmt.Printf("READY\n")
}
// OnCount prints to the console when the feature is queried.
func (l DebugListener) OnCount(name string, enabled bool) {
fmt.Printf("Counted '%s' as enabled? %v\n", name, enabled)
}
// OnSent prints to the console when the server has uploaded metrics.
func (l DebugListener) OnSent(payload MetricsData) {
fmt.Printf("Sent: %+v\n", payload)
}
// OnRegistered prints to the console when the client has registered.
func (l DebugListener) OnRegistered(payload ClientData) {
fmt.Printf("Registered: %+v\n", payload)
}