lib/dexter/log_parser.rb in pgdexter-0.1.5 vs lib/dexter/log_parser.rb in pgdexter-0.1.6
- old
+ new
@@ -4,10 +4,12 @@
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
@@ -36,15 +38,11 @@
if @logfile == STDIN
STDIN.each_line do |line|
yield line
end
else
- begin
- File.foreach(@logfile) do |line|
- yield line
- end
- rescue Errno::ENOENT
- abort "Log file not found"
+ File.foreach(@logfile) do |line|
+ yield line
end
end
end
def process_entry(query, duration)