lib/google/cloud/logging.rb in google-cloud-logging-1.5.7 vs lib/google/cloud/logging.rb in google-cloud-logging-1.6.0

- old
+ new

@@ -81,26 +81,29 @@ # puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}" # end # def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil - project_id ||= (project || default_project_id) - project_id = project_id.to_s # Always cast to a string - raise ArgumentError, "project_id is missing" if project_id.empty? - - scope ||= configure.scope - timeout ||= configure.timeout + project_id ||= (project || default_project_id) + scope ||= configure.scope + timeout ||= configure.timeout client_config ||= configure.client_config + credentials ||= (keyfile || default_credentials(scope: scope)) - credentials ||= (keyfile || default_credentials(scope: scope)) unless credentials.is_a? Google::Auth::Credentials credentials = Logging::Credentials.new credentials, scope: scope end + if credentials.respond_to? :project_id + project_id ||= credentials.project_id + end + project_id = project_id.to_s # Always cast to a string + raise ArgumentError, "project_id is missing" if project_id.empty? + Logging::Project.new( Logging::Service.new( - project_id, credentials, timeout: timeout, + project_id, credentials, timeout: timeout, client_config: client_config ) ) end @@ -134,9 +137,20 @@ # list](https://cloud.google.com/logging/docs/api/v2/resource-list). # Self discovered on GCP. # * `labels` - (Hash) User defined labels. A `Hash` of label names to # string label values or callables/`Proc` which are functions of the # Rack environment. + # * `set_default_logger_on_rails_init` - (Boolean) Whether Google Cloud + # Logging Logger should be allowed to start background threads and open + # gRPC connections during Rails initialization. This should only be used + # with a non-forking web server. Web servers such as Puma and Unicorn + # should not set this, and instead set the Rails logger to a Google + # Cloud Logging Logger object on the worker process by calling + # {Railtie.set_default_logger} at the appropriate time, such as a + # post-fork hook. + # * `on_error` - (Proc) A Proc to be run when an error is encountered + # on a background thread. The Proc must take the error object as the + # single argument. (See {AsyncWriter.on_error}.) # # See the [Configuration # Guide](https://googleapis.github.io/google-cloud-ruby/docs/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION) # for full configuration parameters. #