Skip to content

Commit

Permalink
Added warn_hoptoad
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky committed Jan 7, 2009
1 parent 50a9803 commit 7c0f58e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@ log/*
.DS_Store
coverage
pkg
*.kpf
28 changes: 28 additions & 0 deletions lib/merb_hoptoad_notifier/hoptoad_notifier.rb
Expand Up @@ -20,6 +20,34 @@ def environment_filters
@environment_filters ||= %w(AWS_ACCESS_KEY AWS_SECRET_ACCESS_KEY AWS_ACCOUNT SSH_AUTH_SOCK)
end

def warn_hoptoad(message, request, session, options={})
return if request.nil?
params = request.params

data = {
:api_key => HoptoadNotifier.api_key,
:error_class => options[:error_class] || "Warning",
:error_message => message,
:backtrace => caller,
:environment => ENV.to_hash
}

data[:request] = {
:params => params[:original_params]
}

data[:environment] = clean_hoptoad_environment(ENV.to_hash.merge(request.env))
data[:environment][:RAILS_ENV] = Merb.env

data[:session] = {
:key => session.instance_variable_get("@session_id"),
:data => session.instance_variable_get("@data")
}

send_to_hoptoad :notice => default_notice_options.merge(data)
true
end

def notify_hoptoad(request, session)
return if request.nil?
params = request.params
Expand Down

0 comments on commit 7c0f58e

Please sign in to comment.