lib/contrast/agent_lib/api/init.rb in contrast-agent-6.9.0 vs lib/contrast/agent_lib/api/init.rb in contrast-agent-6.10.0

- old
+ new

@@ -28,11 +28,10 @@ # @param [Symbol] Name of required function. # @param [Array] An array of argument types. # @return [Integer] Return type of the function. attach_function :init, [], :int - # TODO: RUBY-1693 # Initialize agent lib without any optional settings. To set optional settings consider using # `init_with_options` instead If you want to enable logging, it must be set using environment variables # `CONTRAST_AGENTLIB_LOG_LEVEL` - set to log level. Must of one of ERROR, WARN, INFO, DEBUG or TRACE # `CONTRAST_AGENTLIB_LOG_DIR` - must point to an accessible directory where logs will be written. # The name of the log file @@ -43,21 +42,19 @@ # @param [Symbol] Name of required function. # @param [Array] An array of argument types. # @return [Integer] Return type of the function. attach_function :init_with_options, %i[bool string string], :int - # TODO: RUBY-1693 # Change log settings for agent lib after it's been initialized. This api must be used after init # # Safety # The `log_level` parameter must point to must point to an UTF-8 encoded string C-string # @param enable_logging [Boolean] flag to enable or disable logging. # @param log_level [String] UTF-8 encoded string indicating the maximum log level # if logging is enabled attach_function :change_log_settings, %i[bool string], :int - # TODO: RUBY-1693 # Initialize AgentLib with options. # If init returns 0 = successful setup with options # if init returns 1 = unsuccessful setup with options # # @param enable_logging [Boolean] flag to enable or disable logging. @@ -81,19 +78,16 @@ # @return [Boolean] true if initialized, false if not. def dl__init init.zero? end - # TODO: RUBY-1693 # Change the log settings. This api must be called after the dl__init_with_options. # # @param enable_log [Boolean] flag to enable or disable logging this sets the inner flag. # @param log_level [String] OFF, ERROR, WARN, INFO, DEBUG or TRACE. # @return [Boolean] true if initialized false if not. def dl__change_log_settings enable_log, log_level - # transform to C strings pointers here and pass to function. - log_dir_pointer = FFI::MemoryPointer.from_string(log_level.dup.force_encoding('UTF-8')) - return true if change_log_settings(enable_log, log_dir_pointer).zero? + return true if change_log_settings(enable_log, log_level).zero? false end end end