Class: Mole::EMole
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- Mole::EMole
- Defined in:
- lib/mole/e_mole.rb
Instance Method Summary collapse
-
#dump_args(args) ⇒ Object
dumps arguments.
-
#dump_stack(boom) ⇒ Object
dumps partial stack.
-
#exception_alerts(context, user_id, options = {}) ⇒ Object
send out mole exception alerts.
-
#feature_alerts(context, user_id, options = {}) ⇒ Object
send out feature alerts.
-
#perf_alerts(context, user_id, options = {}) ⇒ Object
send out mole performance alert.
-
#setup ⇒ Object
:nodoc:.
Instance Method Details
#dump_args(args) ⇒ Object
dumps arguments
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/mole/e_mole.rb', line 64 def dump_args( args ) return "N/A" unless args buff = [] args.keys.sort { |a,b| a.to_s <=> b.to_s}.each do |k| key = k.to_s.rjust(20) value = args[k].to_s.rjust(97,".") buff << "#{key} : #{value}" end buff.join( "\r" ) end |
#dump_stack(boom) ⇒ Object
dumps partial stack
58 59 60 61 |
# File 'lib/mole/e_mole.rb', line 58 def dump_stack( boom ) return boom if boom.is_a? String buff = boom.backtrace[0...3].join( "\r" ) end |
#exception_alerts(context, user_id, options = {}) ⇒ Object
send out mole exception alerts
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mole/e_mole.rb', line 44 def exception_alerts( context, user_id, ={} ) Mole.logger.debug "Sending perf email from #{::Mole.emole_from} -- to #{::Mole.emole_recipients}" subject "[EXCEPTION] #{@host} -- #{Mole.application} -- #{user_id}" body :application => Mole.application, :host_name => @host, :context => context.class.name, :feature => [:feature], :boom => [:boom], :trace => dump_stack( [:boom] ), :args => dump_args( ) end |
#feature_alerts(context, user_id, options = {}) ⇒ Object
send out feature alerts
19 20 21 22 23 24 25 26 27 |
# File 'lib/mole/e_mole.rb', line 19 def feature_alerts( context, user_id, ={} ) Mole.logger.debug "Sending feature email from #{::Mole.emole_from} -- to #{::Mole.emole_recipients}" subject "[FEATURE] #{[:feature]} -- #{@host} -- #{Mole.application} -- #{user_id}" body :application => Mole.application, :host_name => @host, :context => context.class.name, :feature => [:feature], :args => dump_args( ) end |
#perf_alerts(context, user_id, options = {}) ⇒ Object
send out mole performance alert
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mole/e_mole.rb', line 31 def perf_alerts( context, user_id, ={} ) Mole.logger.debug "Sending perf email from #{::Mole.emole_from} -- to #{::Mole.emole_recipients}" subject "[PERF] #{@host} -- #{Mole.application} -- #{user_id}" body :application => ::Mole.application, :host_name => @host, :context => context.class.name, :feature => [:feature], :elapsed_time => [:elapsed_time] , :args => dump_args( ) end |
#setup ⇒ Object
:nodoc:
7 8 9 10 11 |
# File 'lib/mole/e_mole.rb', line 7 def setup #:nodoc: recipients ::Mole.emole_recipients from ::Mole.emole_from @host = `hostname` end |