Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Manually send along an application name

  • Loading branch information...
commit 37dd0729c36077e815f01aed0e7578b03792b81b 1 parent ecfb1f9
Johan Vermeulen authored
View
8 lib/hoptoad_notifier/configuration.rb
@@ -8,7 +8,7 @@ class Configuration
:ignore_user_agent, :notifier_name, :notifier_url, :notifier_version,
:params_filters, :project_root, :port, :protocol, :proxy_host,
:proxy_pass, :proxy_port, :proxy_user, :secure, :framework,
- :user_information].freeze
+ :user_information, :application].freeze
# The API key for your project, found on the project edit form.
attr_accessor :api_key
@@ -87,11 +87,14 @@ class Configuration
# The framework HoptoadNotifier is configured to use
attr_accessor :framework
+ # Manually add application name prefix
+ attr_accessor :application
+
DEFAULT_PARAMS_FILTERS = %w(password password_confirmation).freeze
DEFAULT_BACKTRACE_FILTERS = [
lambda { |line|
- if defined?(HoptoadNotifier.configuration.project_root) && HoptoadNotifier.configuration.project_root.to_s != ''
+ if defined?(HoptoadNotifier.configuration.project_root) && HoptoadNotifier.configuration.project_root.to_s != ''
line.gsub(/#{HoptoadNotifier.configuration.project_root}/, "[PROJECT_ROOT]")
else
line
@@ -134,6 +137,7 @@ def initialize
@notifier_url = 'http://hoptoadapp.com'
@framework = 'Standalone'
@user_information = 'Hoptoad Error {{error_id}}'
+ @application = 'Replace Me: Application Name'
end
# Takes a block and adds it to the list of backtrace filters. When the filters
View
6 lib/hoptoad_notifier/notice.rb
@@ -69,6 +69,8 @@ class Notice
# The host name where this error occurred (if any)
attr_reader :hostname
+ attr_reader :application
+
def initialize(args)
self.args = args
self.exception = args[:exception]
@@ -96,7 +98,7 @@ def initialize(args)
self.backtrace = Backtrace.parse(exception_attribute(:backtrace, caller), :filters => self.backtrace_filters)
self.error_class = exception_attribute(:error_class) {|exception| exception.class.name }
self.error_message = exception_attribute(:error_message, 'Notification') do |exception|
- "#{exception.class.name}: #{exception.message}"
+ "[#{args[:application]}] #{exception.class.name}: #{exception.message}"
end
self.hostname = local_hostname
@@ -192,7 +194,7 @@ def [](method)
:backtrace_filters, :parameters, :params_filters,
:environment_filters, :session_data, :project_root, :url, :ignore,
:ignore_by_filters, :notifier_name, :notifier_url, :notifier_version,
- :component, :action, :cgi_data, :environment_name, :hostname
+ :component, :action, :cgi_data, :environment_name, :hostname, :application
# Arguments given in the initializer
attr_accessor :args
Please sign in to comment.
Something went wrong with that request. Please try again.