-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeclare_options.go
36 lines (31 loc) · 1.06 KB
/
declare_options.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
package rabbitmq
// DeclareOptions are used to describe a declare configuration.
// Logger is a custom logging interface.
type DeclareOptions struct {
Logger Logger
ConfirmMode bool
}
// getDefaultChannelOptions describes the options that will be used when a value isn't provided
func getDefaultDeclareOptions() DeclareOptions {
return DeclareOptions{
Logger: stdDebugLogger{},
ConfirmMode: false,
}
}
// WithDeclareOptionsLogging sets logging to true on the channel options
// and sets the
func WithDeclareOptionsLogging(options *DeclareOptions) {
options.Logger = &stdDebugLogger{}
}
// WithDeclareOptionsLogger sets logging to a custom interface.
// Use WithDeclareOptionsLogging to just log to stdout.
func WithDeclareOptionsLogger(log Logger) func(options *DeclareOptions) {
return func(options *DeclareOptions) {
options.Logger = log
}
}
// WithDeclareOptionsConfirm enables confirm mode on the connection
// this is required if channel confirmations should be used
func WithDeclareOptionsConfirm(options *DeclareOptions) {
options.ConfirmMode = true
}