lib/dexter/log_parser.rb in pgdexter-0.1.6 vs lib/dexter/log_parser.rb in pgdexter-0.2.0
- old
+ new
@@ -4,12 +4,10 @@
LINE_SEPERATOR = ": ".freeze
def initialize(logfile, collector)
@logfile = logfile
@collector = collector
-
- abort "Log file not found" unless File.exist?(logfile)
end
def perform
active_line = nil
duration = nil
@@ -33,17 +31,11 @@
end
private
def each_line
- if @logfile == STDIN
- STDIN.each_line do |line|
- yield line
- end
- else
- File.foreach(@logfile) do |line|
- yield line
- end
+ @logfile.each_line do |line|
+ yield line
end
end
def process_entry(query, duration)
@collector.add(query, duration)