Skip to content

Instantly share code, notes, and snippets.

@noel9999
Created July 4, 2017 06:18
Show Gist options
  • Save noel9999/c42f4b17fc83fa256deb002ea39052d5 to your computer and use it in GitHub Desktop.
Save noel9999/c42f4b17fc83fa256deb002ea39052d5 to your computer and use it in GitHub Desktop.
module ErrorReporter
extend Forwardable
@name = 'ErrorReporter Class Instance Variable'
@sl_api_client ||= SlApi.api_client
@sl_api_client.public_methods(false).each do |method|
namespace_method = "sl_api_#{method}"
def_delegator @sl_api_client, method, namespace_method
end
def notfiy_newrelic_with(error)
return if !(Rails.env.production? && defined?(NewRelic))
NewRelic::Agent.notice_error(error)
end
def create_activity_log(key:, owner_type:, owner_id:, message: nil, payload: {})
fail 'payload must be kind of Hash' unless payload.kind_of? Hash
params = payload.merge({ key: key, owner_type: owner_type, owner_id: owner_id, message: message})
sl_api_client.post '/activity_logs', params
end
# def client
# ErrorReporter.api_client
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment