general improvements (#2)

* Replaced strutil.Md5 with crypto/md5 and encoding/hex to reduce dependency and potential allocations.

* Move to improved logging library.

* fixup! Move to improved logging library.
This commit is contained in:
2024-06-28 09:22:52 +01:00
committed by GitHub
parent 42170f9b8e
commit 36ef16ad3d
13 changed files with 755 additions and 185 deletions
+12 -3
View File
@@ -6,6 +6,7 @@ import (
"strings"
"time"
libpack_logger "github.com/lukaszraczylo/go-simple-graphql/logging"
"golang.org/x/net/http2"
)
@@ -28,7 +29,10 @@ func (b *BaseClient) createHttpClient() (http_client *http.Client) {
return http.ErrUseLastResponse
},
}
b.Logger.Debug("Using HTTP/1.1 over http", nil)
b.Logger.Debug(&libpack_logger.LogMessage{
Message: "Using HTTP/1.1 over http",
Pairs: nil,
})
} else if strings.HasPrefix(b.endpoint, "https://") {
tlsClientConfig := &tls.Config{}
if strings.HasPrefix(b.endpoint, "https://") {
@@ -46,9 +50,14 @@ func (b *BaseClient) createHttpClient() (http_client *http.Client) {
return http.ErrUseLastResponse
},
}
b.Logger.Debug("Using HTTP/2 over https", nil)
b.Logger.Debug(&libpack_logger.LogMessage{
Message: "Using HTTP/2 over https",
Pairs: nil,
})
} else {
b.Logger.Critical("Invalid endpoint - neither http or https", nil)
b.Logger.Critical(&libpack_logger.LogMessage{
Message: "Invalid endpoint - neither http or https",
})
}
return http_client
}