Skip to content

Dev #86

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Feb 26, 2024
Merged

Dev #86

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions httpclient/httpclient_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ like the baseURL, authentication details, and an embedded standard HTTP client.
package httpclient

import (
"log"
"net/http"
"sync"
"time"
Expand Down Expand Up @@ -83,23 +82,11 @@ type PerformanceMetrics struct {
}

// BuildClient creates a new HTTP client with the provided configuration.
func BuildClient(configFilePath string) (*Client, error) {

// Load the configuration
config, err := SetClientConfiguration(configFilePath)
if err != nil {
log.Printf("Failed to set client configuration: %v", err) // This uses the standard log package before zap logger is initialized
return nil, err
}
func BuildClient(config ClientConfig) (*Client, error) {

// Parse the log level string to logger.LogLevel
parsedLogLevel := logger.ParseLogLevelFromString(config.ClientOptions.LogLevel)

// Set default value if none is provided
if config.ClientOptions.LogConsoleSeparator == "" {
config.ClientOptions.LogConsoleSeparator = ","
}

// Initialize the logger with parsed config values
log := logger.BuildLogger(parsedLogLevel, config.ClientOptions.LogOutputFormat, config.ClientOptions.LogConsoleSeparator)

Expand Down Expand Up @@ -128,7 +115,7 @@ func BuildClient(configFilePath string) (*Client, error) {
AuthMethod: authMethod,
OverrideBaseDomain: config.Environment.OverrideBaseDomain,
httpClient: &http.Client{Timeout: config.ClientOptions.CustomTimeout},
clientConfig: *config,
clientConfig: config,
Logger: log,
ConcurrencyMgr: NewConcurrencyManager(config.ClientOptions.MaxConcurrentRequests, log, true),
PerfMetrics: PerformanceMetrics{},
Expand Down