lib/rackamole/alert/twitt.rb in rackamole-0.2.4 vs lib/rackamole/alert/twitt.rb in rackamole-0.2.5
- old
+ new
@@ -41,23 +41,26 @@
# args :: The moled info for a given feature.
#
def send_alert( args )
twitt_msg = "#{args[:app_name]} on #{format_host(args[:host])} - #{args[:user_name]}\n#{display_feature(args)}"
twitt_msg = case args[:type]
- when Rackamole.feature : "[Feature] #{twitt_msg}"
- when Rackamole.perf : "[Perf] #{twitt_msg}\n#{format_time(args[:request_time])} secs"
- when Rackamole.fault : "[Fault] #{twitt_msg}\n#{args[:fault]}"
- else nil
+ when Rackamole.feature
+ "[Feature] #{twitt_msg}"
+ when Rackamole.perf
+ "[Perf] #{twitt_msg}\n#{format_time(args[:request_time])} secs"
+ when Rackamole.fault
+ "[Fault] #{twitt_msg}\n#{args[:fault]}"
end
if twitt_msg
twitt_msg += " - #{args[:created_at].strftime( "%H:%M:%S")}"
twitt.status( :post, truncate( twitt_msg ) )
end
twitt_msg
rescue => boom
- $stderr.puts "TWITT mole failed with #{boom}"
+ logger.error "Rackamole twitt alert failed with error `#{boom}"
end
+ # =========================================================================
private
attr_reader :username, :password #:nodoc:
# Fetch twitter connection...
\ No newline at end of file