Module: Pulse
- Defined in:
- lib/pulse/rack.rb,
lib/pulse/rails.rb,
lib/pulse/notice.rb,
lib/pulse/sender.rb,
lib/pulse/railtie.rb,
lib/pulse/version.rb,
lib/pulse/backtrace.rb,
lib/pulse/capistrano.rb,
lib/projectlocker_pulse.rb,
lib/pulse/configuration.rb,
lib/pulse/user_informer.rb,
lib/pulse/rails/error_lookup.rb,
lib/pulse/rails/controller_methods.rb,
lib/pulse/rails/javascript_notifier.rb,
lib/pulse/rails/action_controller_catcher.rb,
lib/pulse/rails/middleware/exceptions_catcher.rb
Defined Under Namespace
Modules: Capistrano, Rails, RakeHandler Classes: Backtrace, Configuration, Notice, Rack, Railtie, Sender, UserInformer
Constant Summary collapse
- VERSION =
"1.0.0".freeze
- API_VERSION =
"2.3"
- LOG_PREFIX =
"** [Pulse] "
- HEADERS =
{ 'Content-type' => 'text/xml', 'Accept' => 'text/xml, application/xml' }
Class Attribute Summary collapse
-
.configuration ⇒ Object
The configuration object.
-
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the Pulse server.
Class Method Summary collapse
- .build_lookup_hash_for(exception, options = {}) ⇒ Object
-
.configure(silent = false) {|configuration| ... } ⇒ Object
Call this method to modify defaults in your initializers.
-
.environment_info ⇒ Object
Returns the Ruby version, Rails version, and current Rails environment.
-
.logger ⇒ Object
Look for the Rails logger currently defined.
-
.notify(exception, opts = {}) ⇒ Object
Sends an exception manually using this method, even when you are not in a controller.
-
.notify_or_ignore(exception, opts = {}) ⇒ Object
Sends the notice unless it is one of the default ignored exceptions.
-
.report_environment_info ⇒ Object
Prints out the environment info to the log for debugging help.
-
.report_notice(notice) ⇒ Object
Prints out the details about the notice that wasn’t sent to server.
-
.report_ready ⇒ Object
Tell the log that the Notifier is good to go.
-
.report_response_body(response) ⇒ Object
Prints out the response body from Pulse for debugging help.
-
.write_verbose_log(message) ⇒ Object
Writes out the given message to the #logger.
Class Attribute Details
.configuration ⇒ Object
The configuration object.
87 88 89 |
# File 'lib/projectlocker_pulse.rb', line 87 def configuration @configuration ||= Configuration.new end |
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the Pulse server. Must respond to #send_to_pulse. See Pulse::Sender.
28 29 30 |
# File 'lib/projectlocker_pulse.rb', line 28 def sender @sender end |
Class Method Details
.build_lookup_hash_for(exception, options = {}) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/projectlocker_pulse.rb', line 113 def build_lookup_hash_for(exception, = {}) notice = build_notice_for(exception, ) result = {} result[:action] = notice.action rescue nil result[:component] = notice.component rescue nil result[:error_class] = notice.error_class if notice.error_class result[:environment_name] = 'production' unless notice.backtrace.lines.empty? result[:file] = notice.backtrace.lines.first.file result[:line_number] = notice.backtrace.lines.first.number end result end |
.configure(silent = false) {|configuration| ... } ⇒ Object
Call this method to modify defaults in your initializers.
78 79 80 81 82 83 |
# File 'lib/projectlocker_pulse.rb', line 78 def configure(silent = false) yield(configuration) self.sender = Sender.new(configuration) report_ready unless silent self.sender end |
.environment_info ⇒ Object
Returns the Ruby version, Rails version, and current Rails environment
55 56 57 58 59 |
# File 'lib/projectlocker_pulse.rb', line 55 def environment_info info = "[Ruby: #{RUBY_VERSION}]" info << " [#{configuration.framework}]" if configuration.framework info << " [Env: #{configuration.environment_name}]" if configuration.environment_name end |
.logger ⇒ Object
Look for the Rails logger currently defined
67 68 69 |
# File 'lib/projectlocker_pulse.rb', line 67 def logger self.configuration.logger end |
.notify(exception, opts = {}) ⇒ Object
Sends an exception manually using this method, even when you are not in a controller.
102 103 104 |
# File 'lib/projectlocker_pulse.rb', line 102 def notify(exception, opts = {}) send_notice(build_notice_for(exception, opts)) end |
.notify_or_ignore(exception, opts = {}) ⇒ Object
Sends the notice unless it is one of the default ignored exceptions
108 109 110 111 |
# File 'lib/projectlocker_pulse.rb', line 108 def notify_or_ignore(exception, opts = {}) notice = build_notice_for(exception, opts) send_notice(notice) unless notice.ignore? end |
.report_environment_info ⇒ Object
Prints out the environment info to the log for debugging help
40 41 42 |
# File 'lib/projectlocker_pulse.rb', line 40 def report_environment_info write_verbose_log("Environment Info: #{environment_info}") end |
.report_notice(notice) ⇒ Object
Prints out the details about the notice that wasn’t sent to server
50 51 52 |
# File 'lib/projectlocker_pulse.rb', line 50 def report_notice(notice) write_verbose_log("Notice details: \n#{notice}") end |
.report_ready ⇒ Object
Tell the log that the Notifier is good to go
35 36 37 |
# File 'lib/projectlocker_pulse.rb', line 35 def report_ready write_verbose_log("Notifier #{VERSION} ready to catch errors") end |
.report_response_body(response) ⇒ Object
Prints out the response body from Pulse for debugging help
45 46 47 |
# File 'lib/projectlocker_pulse.rb', line 45 def report_response_body(response) write_verbose_log("Response from Pulse: \n#{response}") end |
.write_verbose_log(message) ⇒ Object
Writes out the given message to the #logger
62 63 64 |
# File 'lib/projectlocker_pulse.rb', line 62 def write_verbose_log() logger.debug LOG_PREFIX + if logger end |