From ad60e84b3cf744a0b009591ae4b551deb9fbc56e Mon Sep 17 00:00:00 2001 From: ShocOne <62835948+ShocOne@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:19:52 +0000 Subject: [PATCH 1/2] Remove unused import and update BuildClient function signature --- httpclient/httpclient_client.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/httpclient/httpclient_client.go b/httpclient/httpclient_client.go index 2e6a19b..8f357a5 100644 --- a/httpclient/httpclient_client.go +++ b/httpclient/httpclient_client.go @@ -8,7 +8,6 @@ like the baseURL, authentication details, and an embedded standard HTTP client. package httpclient import ( - "log" "net/http" "sync" "time" @@ -83,14 +82,7 @@ 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) @@ -128,7 +120,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{}, From 2d7ca5ece60ef0c6f4f4f08f062544590a5fc491 Mon Sep 17 00:00:00 2001 From: ShocOne <62835948+ShocOne@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:20:24 +0000 Subject: [PATCH 2/2] Remove default value for LogConsoleSeparator --- httpclient/httpclient_client.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/httpclient/httpclient_client.go b/httpclient/httpclient_client.go index 8f357a5..8483301 100644 --- a/httpclient/httpclient_client.go +++ b/httpclient/httpclient_client.go @@ -87,11 +87,6 @@ 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)