Module: Raven
- Defined in:
- lib/raven/backtrace.rb,
lib/raven.rb,
lib/raven/rack.rb,
lib/raven/error.rb,
lib/raven/event.rb,
lib/raven/client.rb,
lib/raven/logger.rb,
lib/raven/railtie.rb,
lib/raven/sidekiq.rb,
lib/raven/version.rb,
lib/raven/linecache.rb,
lib/raven/processor.rb,
lib/raven/interfaces.rb,
lib/raven/configuration.rb,
lib/raven/interfaces/http.rb,
lib/raven/interfaces/message.rb,
lib/raven/interfaces/exception.rb,
lib/raven/interfaces/stack_trace.rb,
lib/raven/processors/sanitizedata.rb,
lib/raven/rails/middleware/debug_exceptions_catcher.rb
Overview
A much simpler source line cacher because linecache sucks at platform compat
Defined Under Namespace
Modules: Processor, Rails Classes: Backtrace, Client, Configuration, Error, Event, ExceptionInterface, HttpInterface, Interface, LineCache, Logger, MessageInterface, Rack, Railtie, Sidekiq, StacktraceInterface
Constant Summary collapse
- VERSION =
"0.4.0"
- INTERFACES =
{}
Class Attribute Summary collapse
-
.client ⇒ Object
The client object is responsible for delivering formatted data to the Sentry server.
-
.configuration ⇒ Object
The configuration object.
Class Method Summary collapse
-
.capture(options = {}, &block) ⇒ Object
Capture and process any exceptions from the given block, or globally if no block is given.
- .capture_exception(exception, options = {}) ⇒ Object (also: captureException)
- .capture_message(message, options = {}) ⇒ Object (also: captureMessage)
-
.configure(silent = false) {|configuration| ... } ⇒ Object
Call this method to modify defaults in your initializers.
- .find_interface(name) ⇒ Object
- .logger ⇒ Object
- .register_interface(mapping) ⇒ Object
-
.report_ready ⇒ Object
Tell the log that the client is good to go.
-
.send(evt) ⇒ Object
Send an event to the configured Sentry server.
Class Attribute Details
.client ⇒ Object
The client object is responsible for delivering formatted data to the Sentry server. Must respond to #send. See Raven::Client.
22 23 24 |
# File 'lib/raven.rb', line 22 def client @client end |
.configuration ⇒ Object
The configuration object.
39 40 41 |
# File 'lib/raven.rb', line 39 def configuration @configuration ||= Configuration.new end |
Class Method Details
.capture(options = {}, &block) ⇒ Object
Capture and process any exceptions from the given block, or globally if no block is given
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/raven.rb', line 72 def capture(={}, &block) if block begin block.call rescue Error => e raise # Don't capture Raven errors rescue Exception => e capture_exception(e, ) raise end else # Install at_exit hook at_exit do if $! logger.debug "Caught a post-mortem exception: #{$!.inspect}" capture_exception($!, ) end end end end |
.capture_exception(exception, options = {}) ⇒ Object Also known as: captureException
93 94 95 96 |
# File 'lib/raven.rb', line 93 def capture_exception(exception, ={}) evt = Event.capture_exception(exception, ) send(evt) if evt end |
.capture_message(message, options = {}) ⇒ Object Also known as: captureMessage
98 99 100 101 |
# File 'lib/raven.rb', line 98 def (, ={}) evt = Event.(, ) send(evt) if evt end |
.configure(silent = false) {|configuration| ... } ⇒ Object
Call this method to modify defaults in your initializers.
49 50 51 52 53 54 |
# File 'lib/raven.rb', line 49 def configure(silent = false) yield(configuration) self.client = Client.new(configuration) report_ready unless silent self.client end |
.find_interface(name) ⇒ Object
33 34 35 |
# File 'lib/raven/interfaces.rb', line 33 def self.find_interface(name) INTERFACES[name.to_s] end |
.logger ⇒ Object
28 29 30 |
# File 'lib/raven.rb', line 28 def logger @logger ||= Logger.new end |
.register_interface(mapping) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/raven/interfaces.rb', line 26 def self.register_interface(mapping) mapping.each_pair do |key, klass| INTERFACES[key.to_s] = klass INTERFACES[klass.name] = klass end end |
.report_ready ⇒ Object
Tell the log that the client is good to go
33 34 35 |
# File 'lib/raven.rb', line 33 def report_ready self.logger.info "Raven #{VERSION} ready to catch errors" end |
.send(evt) ⇒ Object
Send an event to the configured Sentry server
61 62 63 |
# File 'lib/raven.rb', line 61 def send(evt) @client.send(evt) if @client end |