rackamole 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rackamole.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Rackamole
2
2
 
3
3
  # :stopdoc:
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.5'
5
5
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
6
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
7
  # :startdoc:
@@ -8,10 +8,10 @@ module Rackamole::Alert
8
8
  def self.template_root() @template_root ||= File.join( File.dirname(__FILE__), %w[templates] ); end
9
9
 
10
10
  # Send an email notification for particular moled feature. An email will
11
- # be sent based on the two configuration :emails and :mail_on defined on the
12
- # Rack::Mole component. These specify the to and from addresses and the conditions
13
- # that will trigger the email, currently :enabled and :features for the type of
14
- # moled features to track via email. The notification will be sent via Pony,
11
+ # be sent based on the configuration :email defined on the
12
+ # Rack::Mole component. This option must specify the to and from addresses and the conditions
13
+ # that will trigger the email defined by alert_on for the type of
14
+ # moled features to track via email. The notification will be sent via Mail,
15
15
  # so you will need to make sure it is properly configured for your domain.
16
16
  # NOTE: This is just a notification mechanism. All moled event will be either logged
17
17
  # or persisted in the db regardless.
@@ -75,11 +75,15 @@ module Rackamole::Alert
75
75
 
76
76
  # Format args and spit out into buffer
77
77
  def self.spew( key, silent=false )
78
- buff = []
78
+ buff = []
79
+ value = args[key]
80
+
81
+ value = request_time?( args ) if key == :request_time
79
82
 
80
- _spew( buff, '--', (silent ? '' : ' '), key, args[key], silent )
83
+ _spew( buff, '--', (silent ? '' : ' '), key, value, silent )
81
84
  buff.join( "\n" )
82
85
  end
86
+
83
87
  def self._spew( buff, sep, indent, key, value, silent )
84
88
  if value.is_a?( Hash )
85
89
  buff << "#{indent}#{humanize( key )}:" unless silent
@@ -114,7 +118,7 @@ module Rackamole::Alert
114
118
 
115
119
  # Dump request time if any...
116
120
  def self.request_time?( args )
117
- args[:type] == Rackamole.perf ? ("%5.2f " % args[:request_time] ) : ''
121
+ args[:request_time] ? ("%5.2f " % args[:request_time] ) : ''
118
122
  end
119
123
 
120
124
  # Identify the type of alert...
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackamole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernand Galiana