Class: Woodchuck::Watcher
- Inherits:
-
Object
- Object
- Woodchuck::Watcher
- Extended by:
- Forwardable
- Defined in:
- lib/woodchuck/watcher.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#events ⇒ Object
Returns the value of attribute events.
-
#input_format ⇒ Object
Returns the value of attribute input_format.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#paths ⇒ Object
Returns the value of attribute paths.
Instance Method Summary collapse
-
#initialize(agent, log_level, input_format, *paths) ⇒ Watcher
constructor
A new instance of Watcher.
- #inspect ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(agent, log_level, input_format, *paths) ⇒ Watcher
Returns a new instance of Watcher.
17 18 19 20 21 22 23 |
# File 'lib/woodchuck/watcher.rb', line 17 def initialize(agent, log_level, input_format, *paths) @agent = agent @logger = Woodchuck::Logger.new(::STDOUT) @logger.level = log_level unless log_level.nil? @paths = paths.flatten.compact @input_format = input_format end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
14 15 16 |
# File 'lib/woodchuck/watcher.rb', line 14 def agent @agent end |
#events ⇒ Object
Returns the value of attribute events.
14 15 16 |
# File 'lib/woodchuck/watcher.rb', line 14 def events @events end |
#input_format ⇒ Object
Returns the value of attribute input_format.
14 15 16 |
# File 'lib/woodchuck/watcher.rb', line 14 def input_format @input_format end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/woodchuck/watcher.rb', line 14 def logger @logger end |
#paths ⇒ Object
Returns the value of attribute paths.
14 15 16 |
# File 'lib/woodchuck/watcher.rb', line 14 def paths @paths end |
Instance Method Details
#inspect ⇒ Object
35 36 37 |
# File 'lib/woodchuck/watcher.rb', line 35 def inspect to_s end |
#start ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/woodchuck/watcher.rb', line 25 def start Woodchuck::TailReader.static_init(input_format, output) EventMachine.run do paths.each do |path| EventMachine::FileGlobWatchTail.new(path, Woodchuck::TailReader) end end end |