-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathoption.go
36 lines (30 loc) · 890 Bytes
/
option.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
// Copyright (c) 2025 The konf authors
// Use of this source code is governed by a MIT license found in the LICENSE file.
package azservicebus
import (
"log/slog"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
)
// WithCredential provides the azcore.TokenCredential for Azure authentication.
//
// By default, it uses azidentity.DefaultAzureCredential.
func WithCredential(credential azcore.TokenCredential) Option {
return func(options *options) {
options.credential = credential
}
}
// WithLogHandler provides the slog.Handler for logs from notifier.
//
// By default, it uses handler from slog.Default().
func WithLogHandler(handler slog.Handler) Option {
return func(options *options) {
if handler != nil {
options.logger = slog.New(handler)
}
}
}
type (
// Option configures the Notifier with specific options.
Option func(options *options)
options Notifier
)