Sha256: 79d3758fec961061eedafa71d6791046bc044739b15509e37e6a8b04f4a0d134
Contents?: true
Size: 923 Bytes
Versions: 1
Compression:
Stored size: 923 Bytes
Contents
require 'yaml_notifier/exception_log' module ExceptionNotifier class YamlNotifier def initialize(options) # initialize options here @extra_params = options[:extra_params] || [] end def call(exception, options={}) log = ::YamlNotifier::ExceptionLog.new({ title: exception.inspect, message: exception.message, backtrace: exception.backtrace.join("\n") }) env = options[:env] unless env.nil? log.user_agent = env['HTTP_USER_AGENT'] log.request_uri = env['REQUEST_URI'] log.request_method = env['REQUEST_METHOD'] log.controller = env['action_dispatch.request.path_parameters'][:controller] log.action = env['action_dispatch.request.path_parameters'][:action] log.extra_params = @extra_params.map{|p| env[p]} unless @extra_params.empty? end log.save end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yaml_notifier-0.0.1 | lib/exception_notifier/yaml_notifier.rb |