Created
July 4, 2017 06:18
-
-
Save noel9999/c42f4b17fc83fa256deb002ea39052d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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