Class: LogMonitor::FileAlerter

Inherits:
Alerter
  • Object
show all
Defined in:
lib/log_monitor/alerter.rb

Instance Method Summary collapse

Methods inherited from Alerter

#check_words, #clear_alert, #initialize, #monitor, #set_in, #set_words

Constructor Details

This class inherits a constructor from LogMonitor::Alerter

Instance Method Details

#alertObject



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/log_monitor/alerter.rb', line 81

def alert
  begin
    File.open(@filename, 'a') do | io_out |
      io_out.puts @alert_body
    end
  rescue => e
    $stderr.puts "LogMonitor error"
    $stderr.puts e.message
    2.times $stderr.puts
  end
  clear_alert
end

#set_out(filename) ⇒ Object



77
78
79
# File 'lib/log_monitor/alerter.rb', line 77

def set_out(filename)
  @filename = filename
end