Class: Raven::Client
- Inherits:
-
Object
- Object
- Raven::Client
- Defined in:
- lib/raven/client.rb
Constant Summary collapse
- PROTOCOL_VERSION =
'3'
- USER_AGENT =
"raven-ruby/#{Raven::VERSION}"
- CONTENT_TYPE =
'application/json'
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Client
constructor
A new instance of Client.
- #send(event) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Client
Returns a new instance of Client.
19 20 21 22 |
# File 'lib/raven/client.rb', line 19 def initialize(configuration) @configuration = configuration @processors = configuration.processors.map { |v| v.new(self) } end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
17 18 19 |
# File 'lib/raven/client.rb', line 17 def configuration @configuration end |
Instance Method Details
#send(event) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/raven/client.rb', line 24 def send(event) unless configuration.send_in_current_environment? configuration. return end # Set the project ID correctly event.project = self.configuration.project_id Raven.logger.debug "Sending event #{event.id} to Sentry" content_type, encoded_data = encode(event) begin transport.send(generate_auth_header(encoded_data), encoded_data, :content_type => content_type) rescue => e Raven.logger.error "Unable to record event with remote Sentry server (#{e.class} - #{e.})" e.backtrace[0..10].each { |line| Raven.logger.error(line) } return end event end |