registry: setup client logger
This commit is contained in:
parent
a3f26ccd12
commit
4f55721c2e
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/hashicorp/go-retryablehttp"
|
"github.com/hashicorp/go-retryablehttp"
|
||||||
"github.com/hashicorp/terraform-svchost"
|
"github.com/hashicorp/terraform-svchost"
|
||||||
"github.com/hashicorp/terraform-svchost/disco"
|
"github.com/hashicorp/terraform-svchost/disco"
|
||||||
|
"github.com/hashicorp/terraform/helper/logging"
|
||||||
"github.com/hashicorp/terraform/httpclient"
|
"github.com/hashicorp/terraform/httpclient"
|
||||||
"github.com/hashicorp/terraform/registry/regsrc"
|
"github.com/hashicorp/terraform/registry/regsrc"
|
||||||
"github.com/hashicorp/terraform/registry/response"
|
"github.com/hashicorp/terraform/registry/response"
|
||||||
|
@ -74,6 +75,13 @@ func NewClient(services *disco.Disco, client *http.Client) *Client {
|
||||||
retryableClient.RequestLogHook = requestLogHook
|
retryableClient.RequestLogHook = requestLogHook
|
||||||
retryableClient.ErrorHandler = maxRetryErrorHandler
|
retryableClient.ErrorHandler = maxRetryErrorHandler
|
||||||
|
|
||||||
|
logOutput, err := logging.LogOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[WARN] Failed to set up registry client logger, "+
|
||||||
|
"continuing without client logging: %s", err)
|
||||||
|
}
|
||||||
|
retryableClient.Logger = log.New(logOutput, "", log.Flags())
|
||||||
|
|
||||||
services.Transport = retryableClient.HTTPClient.Transport
|
services.Transport = retryableClient.HTTPClient.Transport
|
||||||
|
|
||||||
services.SetUserAgent(httpclient.TerraformUserAgent(version.String()))
|
services.SetUserAgent(httpclient.TerraformUserAgent(version.String()))
|
||||||
|
|
Loading…
Reference in New Issue