lib/ff/ruby/server/sdk/connector/harness_connector.rb in ff-ruby-server-sdk-1.1.0 vs lib/ff/ruby/server/sdk/connector/harness_connector.rb in ff-ruby-server-sdk-1.1.1

- old
+ new

@@ -33,11 +33,11 @@ } response = @api.authenticate(opts = options) @token = response.auth_token - @config.logger.info "Token has been obtained" + @config.logger.debug "Token has been obtained" process_token return 200 rescue OpenapiClient::ApiError => e @@ -47,11 +47,11 @@ # https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.3.0 @config.logger.warn "OpenapiClient::ApiError [\n\n#{e}\n]" return -1 end - log_error(e) + log_error("auth", e) return e.code end end def get_flags @@ -64,11 +64,11 @@ opts = get_query_params ) rescue OpenapiClient::ApiError => e - log_error(e) + log_error("get_feature_config", e) return nil end end def get_segments @@ -81,11 +81,11 @@ opts = get_query_params ) rescue OpenapiClient::ApiError => e - log_error(e) + log_error("get_all_segments", e) return nil end end def get_flag(identifier) @@ -125,16 +125,15 @@ environment = @environment, opts = options ) - @config.logger.info "Successfully sent analytics data to the server" + @config.logger.debug "Successfully sent analytics data to the server" rescue OpenapiClient::ApiError => e - - log_error(e) - @config.logger.error "Exception while posting metrics to the event server" + log_error("post_metrics", e) + SdkCodes.warn_post_metrics_failed @config.logger, e.message end end def stream(updater) @@ -246,16 +245,16 @@ :'cluster' => @cluster } } end - def log_error(e) + def log_error(prefix, e) if e.code == 0 type = "typhoeus/libcurl" else type = "HTTP code #{e.code}" end - @config.logger.warn "OpenapiClient::ApiError (#{type}) [\n\n" + e.to_s + "\n]" + @config.logger.warn "%s: OpenapiClient::ApiError (%s) [\n\n%s\n]" % [prefix, type, e.to_s] end end \ No newline at end of file