@@ -18,12 +18,14 @@ import (
18
18
"github.com/deploymenttheory/go-api-http-client/redirecthandler"
19
19
)
20
20
21
+ const ()
22
+
21
23
// TODO all struct comments
22
24
23
25
// Master struct/object
24
26
type Client struct {
25
27
// Config
26
- config ClientConfig
28
+ config * ClientConfig
27
29
28
30
// Integration
29
31
Integration * APIIntegration
@@ -92,20 +94,24 @@ type ClientConfig struct {
92
94
}
93
95
94
96
// BuildClient creates a new HTTP client with the provided configuration.
95
- func (c ClientConfig ) Build () (* Client , error ) {
97
+ func (c * ClientConfig ) Build () (* Client , error ) {
96
98
if c .Sugar == nil {
97
99
zapLogger , err := zap .NewProduction ()
98
100
if err != nil {
99
101
return nil , err
100
102
}
101
103
102
104
c .Sugar = zapLogger .Sugar ()
105
+ c .Sugar .Info ("No logger provided. Defaulting to Sugared Zap Production Logger" )
103
106
}
104
107
108
+ c .Sugar .Debug ("validating configuration" )
109
+
105
110
err := c .validateClientConfig ()
106
111
if err != nil {
107
112
return nil , fmt .Errorf ("invalid configuration: %v" , err )
108
113
}
114
+ c .Sugar .Debug ("configuration valid" )
109
115
110
116
httpClient := & http.Client {
111
117
Timeout : c .CustomTimeout ,
@@ -138,6 +144,7 @@ func (c ClientConfig) Build() (*Client, error) {
138
144
}
139
145
140
146
if len (client .config .CustomCookies ) > 0 {
147
+ client .Sugar .Debug ("setting custom cookies" )
141
148
client .loadCustomCookies ()
142
149
}
143
150
0 commit comments