simple_monitor 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -35,13 +35,15 @@ require "simple_monitor"
35
35
  class HighJobMonitor
36
36
  include SimpleMonitor
37
37
 
38
+ # This is the most important method you should override
39
+ # It returns true/false to determine if there's an alert
38
40
  def needs_alert?
39
41
  Queue.jobs.count > options[:job_count_threshold]
40
42
  end
41
43
 
44
+ # Alert sending implementation of your choice. SimpleMonitor
45
+ # leaves this up to you
42
46
  def send_alert
43
- # Alert sending method of your choice. SimpleMonitor
44
- # leaves this up to you
45
47
  Mailer.deliver_high_job_alert(Queue.jobs.count)
46
48
  end
47
49
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleMonitor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -84,6 +84,8 @@ module SimpleMonitor
84
84
  @logger ||=
85
85
  if defined?(Rails)
86
86
  Rails.logger
87
+ elsif defined?(Padrino)
88
+ Padrino.logger
87
89
  else
88
90
  require "logger"
89
91
  Logger.new(STDOUT)
@@ -21,7 +21,7 @@ describe SimpleMonitor do
21
21
  monitor.options[:foo].should == :bar
22
22
  end
23
23
 
24
- it "extacts :only_explicit_logging from the passed options" do
24
+ it "extracts :only_explicit_logging from the passed options" do
25
25
  TestMonitor.new.only_explicit_logging.should be_nil
26
26
  TestMonitor.new(:only_explicit_logging => true).only_explicit_logging.should be_true
27
27
  end
@@ -48,6 +48,18 @@ describe SimpleMonitor, "logger" do
48
48
  Object.send(:remove_const, :Rails)
49
49
  end
50
50
 
51
+ it "is defaulted to the Padrino.logger if present" do
52
+ module Padrino
53
+ def self.logger
54
+ :padrino_logger
55
+ end
56
+ end
57
+
58
+ subject.logger.should == :padrino_logger
59
+
60
+ Object.send(:remove_const, :Padrino)
61
+ end
62
+
51
63
  it "sends info, warn, error, and debug methods to it prefixed by the class name" do
52
64
  stub_logger = stub('logger')
53
65
  subject.logger = stub_logger
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &2155990900 !ruby/object:Gem::Requirement
17
+ requirement: &2161263720 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2155990900
25
+ version_requirements: *2161263720
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2155968720 !ruby/object:Gem::Requirement
28
+ requirement: &2161263300 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2155968720
36
+ version_requirements: *2161263300
37
37
  description: ''
38
38
  email:
39
39
  - xternal1+github@gmail.com