Module: Couchbase

Defined in:
lib/couchbase/utils.rb,
lib/couchbase/scope.rb,
lib/couchbase/bucket.rb,
lib/couchbase/errors.rb,
lib/couchbase/logger.rb,
lib/couchbase/subdoc.rb,
lib/couchbase/cluster.rb,
lib/couchbase/options.rb,
lib/couchbase/version.rb,
lib/couchbase/collection.rb,
lib/couchbase/management.rb,
lib/couchbase/utils/time.rb,
lib/couchbase/diagnostics.rb,
lib/couchbase/protostellar.rb,
lib/couchbase/view_options.rb,
lib/couchbase/authenticator.rb,
lib/couchbase/configuration.rb,
lib/couchbase/query_options.rb,
lib/couchbase/datastructures.rb,
lib/couchbase/key_value_scan.rb,
lib/couchbase/mutation_state.rb,
lib/couchbase/search_options.rb,
lib/couchbase/config_profiles.rb,
lib/couchbase/json_transcoder.rb,
lib/couchbase/cluster_registry.rb,
lib/couchbase/transcoder_flags.rb,
lib/couchbase/analytics_options.rb,
lib/couchbase/binary_collection.rb,
lib/couchbase/collection_options.rb,
lib/couchbase/protostellar/retry.rb,
lib/couchbase/protostellar/scope.rb,
lib/couchbase/protostellar/bucket.rb,
lib/couchbase/protostellar/client.rb,
lib/couchbase/raw_json_transcoder.rb,
lib/couchbase/protostellar/cluster.rb,
lib/couchbase/protostellar/request.rb,
lib/couchbase/protostellar/timeouts.rb,
lib/couchbase/raw_binary_transcoder.rb,
lib/couchbase/raw_string_transcoder.rb,
lib/couchbase/protostellar/generated.rb,
lib/couchbase/management/user_manager.rb,
lib/couchbase/protostellar/collection.rb,
lib/couchbase/protostellar/management.rb,
lib/couchbase/binary_collection_options.rb,
lib/couchbase/management/bucket_manager.rb,
lib/couchbase/protostellar/retry/action.rb,
lib/couchbase/protostellar/retry/reason.rb,
lib/couchbase/protostellar/error_handling.rb,
lib/couchbase/utils/stdlib_logger_adapter.rb,
lib/couchbase/datastructures/couchbase_map.rb,
lib/couchbase/datastructures/couchbase_set.rb,
lib/couchbase/protostellar/connect_options.rb,
lib/couchbase/utils/generic_logger_adapter.rb,
lib/couchbase/datastructures/couchbase_list.rb,
lib/couchbase/management/collection_manager.rb,
lib/couchbase/management/view_index_manager.rb,
lib/couchbase/protostellar/retry/strategies.rb,
lib/couchbase/protostellar/timeout_defaults.rb,
lib/couchbase/datastructures/couchbase_queue.rb,
lib/couchbase/management/query_index_manager.rb,
lib/couchbase/protostellar/binary_collection.rb,
lib/couchbase/protostellar/request_behaviour.rb,
lib/couchbase/protostellar/request_generator.rb,
lib/couchbase/management/search_index_manager.rb,
lib/couchbase/protostellar/response_converter.rb,
lib/couchbase/protostellar/retry/orchestrator.rb,
lib/couchbase/protostellar/request_generator/kv.rb,
lib/couchbase/management/analytics_index_manager.rb,
lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb,
lib/couchbase/protostellar/response_converter/kv.rb,
lib/couchbase/protostellar/request_generator/admin.rb,
lib/couchbase/protostellar/request_generator/query.rb,
lib/couchbase/management/scope_search_index_manager.rb,
lib/couchbase/protostellar/request_generator/search.rb,
lib/couchbase/protostellar/response_converter/admin.rb,
lib/couchbase/protostellar/response_converter/query.rb,
lib/couchbase/protostellar/generated/view/v1/view_pb.rb,
lib/couchbase/protostellar/management/bucket_manager.rb,
lib/couchbase/protostellar/response_converter/search.rb,
lib/couchbase/protostellar/generated/query/v1/query_pb.rb,
lib/rails/generators/couchbase/config/config_generator.rb,
lib/couchbase/management/collection_query_index_manager.rb,
lib/couchbase/protostellar/retry/strategies/best_effort.rb,
lib/couchbase/protostellar/generated/search/v1/search_pb.rb,
lib/couchbase/protostellar/management/collection_manager.rb,
lib/couchbase/protostellar/request_generator/admin/query.rb,
lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb,
lib/couchbase/protostellar/management/query_index_manager.rb,
lib/couchbase/protostellar/request_generator/admin/bucket.rb,
lib/couchbase/protostellar/response_converter/admin/query.rb,
lib/couchbase/protostellar/generated/routing/v1/routing_pb.rb,
lib/couchbase/protostellar/response_converter/admin/bucket.rb,
lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb,
lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb,
lib/couchbase/protostellar/request_generator/admin/collection.rb,
lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb,
lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb,
lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb,
lib/couchbase/protostellar/response_converter/admin/collection.rb,
lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb,
lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb,
lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb,
lib/couchbase/protostellar/generated/routing/v1/routing_services_pb.rb,
lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb,
lib/couchbase/protostellar/management/collection_query_index_manager.rb,
lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb,
lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb,
lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb,
lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb,
lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb,
lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb,
lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb,
lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb

Overview

frozen_string_literal: true

Defined Under Namespace

Modules: ConfigProfiles, Datastructures, Error, Generators, Management, Options, Protostellar, Utils Classes: BinaryCollection, Bucket, CertificateAuthenticator, Cluster, ClusterRegistry, Collection, Configuration, CoreScanResult, DiagnosticsResult, JsonTranscoder, LookupInSpec, MutateInSpec, MutationState, MutationToken, PasswordAuthenticator, PingResult, PrefixScan, RangeScan, RawBinaryTranscoder, RawJsonTranscoder, RawStringTranscoder, SamplingScan, ScanTerm, Scope, SearchFacet, SearchFacetResult, SearchMetaData, SearchMetrics, SearchQuery, SearchRequest, SearchResult, SearchRow, SearchRowLocation, SearchRowLocations, SearchSort, TranscoderFlags, VectorQuery, VectorSearch

Constant Summary collapse

VERSION =

Version of the library and all bundled dependencies

Examples:

Display version (Couchbase::BUILD_INFO contains more details)

$ ruby -rcouchbase -e 'pp Couchbase::VERSION'
{:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
{}

Class Method Summary collapse

Class Method Details

.log_levelSymbol

Get current log level



43
44
45
# File 'lib/couchbase/logger.rb', line 43

def self.log_level
  Backend.get_log_level
end

.log_level=(level) ⇒ void

Note:

The level might be also be set with environment variable COUCHBASE_BACKEND_LOG_LEVEL

This method returns an undefined value.

Set log level



36
37
38
# File 'lib/couchbase/logger.rb', line 36

def self.log_level=(level)
  Backend.set_log_level(level)
end

.loggerObject

Return logger associated with the library



48
49
50
# File 'lib/couchbase/logger.rb', line 48

def self.logger
  @logger # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
end

.set_logger(logger, adapter_class: nil, verbose: false, level: :info) ⇒ Object

Associate logger with the library

The log messages, that are generated by extension might come with out of order timestamps, in order to reduce number of switches between Ruby and Native code.

Examples:

Specify custom logger and limit core messages to debug level

Couchbase.set_logger(Logger.new(STDERR), level: :debug)

Since:

  • 3.4.0



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/couchbase/logger.rb', line 69

def self.set_logger(logger, adapter_class: nil, verbose: false, level: :info)
  @logger = logger # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
  if @logger.nil? # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
    Backend.install_logger_shim(nil)
    return
  end
  shim =
    if adapter_class
      adapter_class
    elsif logger.is_a?(::Logger)
      require "couchbase/utils/stdlib_logger_adapter"
      Utils::StdlibLoggerAdapter
    else
      require "couchbase/utils/generic_logger_adapter"
      Utils::GenericLoggerAdapter
    end
  Backend.install_logger_shim(shim.new(logger, verbose: verbose), level)
end