Class: Bracken::Logfile
- Inherits:
-
Object
- Object
- Bracken::Logfile
- Defined in:
- lib/bracken/logfile.rb,
lib/bracken/logfile/filter.rb,
lib/bracken/logfile/stream.rb
Defined Under Namespace
Modules: Stream Classes: Filter
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#number_of_lines ⇒ Object
readonly
Returns the value of attribute number_of_lines.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, number_of_lines) ⇒ Logfile
constructor
A new instance of Logfile.
- #stream ⇒ Object
Constructor Details
#initialize(path, number_of_lines) ⇒ Logfile
Returns a new instance of Logfile.
11 12 13 14 15 |
# File 'lib/bracken/logfile.rb', line 11 def initialize(path, number_of_lines) @filters = [] @number_of_lines = number_of_lines @path = path end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
7 8 9 |
# File 'lib/bracken/logfile.rb', line 7 def filters @filters end |
#number_of_lines ⇒ Object (readonly)
Returns the value of attribute number_of_lines.
8 9 10 |
# File 'lib/bracken/logfile.rb', line 8 def number_of_lines @number_of_lines end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/bracken/logfile.rb', line 9 def path @path end |
Instance Method Details
#stream ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bracken/logfile.rb', line 17 def stream @stream ||= begin pid, _, out, _ = Open4.popen4("tail -n #{number_of_lines} -F #{path}") out.extend(Stream) out.logfile = self out.pid = pid out end end |