Class: BlackDog::LogFile
- Inherits:
-
Object
- Object
- BlackDog::LogFile
- Defined in:
- lib/blackdog/blackdog.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#watches ⇒ Object
readonly
Returns the value of attribute watches.
Instance Method Summary collapse
- #each_watch ⇒ Object
-
#initialize(path) ⇒ LogFile
constructor
A new instance of LogFile.
- #watch {|w = Watch.new| ... } ⇒ Object
Constructor Details
#initialize(path) ⇒ LogFile
72 73 74 75 |
# File 'lib/blackdog/blackdog.rb', line 72 def initialize(path) @path = path @watches = [] end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
70 71 72 |
# File 'lib/blackdog/blackdog.rb', line 70 def path @path end |
#watches ⇒ Object (readonly)
Returns the value of attribute watches.
70 71 72 |
# File 'lib/blackdog/blackdog.rb', line 70 def watches @watches end |
Instance Method Details
#each_watch ⇒ Object
99 100 101 |
# File 'lib/blackdog/blackdog.rb', line 99 def each_watch @watches.each {|w| yield w } end |
#watch {|w = Watch.new| ... } ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/blackdog/blackdog.rb', line 77 def watch yield w = Watch.new @watches << w # {{{ logging if w.throttle BlackDog.log.debug(@path) { "watching for #{w.pattern.inspect} with throttle \ #{w.throttle[:times]}/#{w.throttle[:every]} secs" } else BlackDog.log.debug(@path) { "watching for #{w.pattern.inspect}" } if w.throttle == false BlackDog.log.warn(@path) { "ignoring invalid throttle for watch #{w.pattern.inspect}" } end end # }}} end |