class Notification::FileNotification
Public Class Methods
file_dir()
click to toggle source
# File lib/gaddygaddy-client/notification/file_notification.rb, line 24 def self.file_dir @file_dir end
file_dir=(file_dir)
click to toggle source
# File lib/gaddygaddy-client/notification/file_notification.rb, line 20 def self.file_dir= file_dir @file_dir = file_dir end
notify(event, message_text)
click to toggle source
# File lib/gaddygaddy-client/notification/file_notification.rb, line 28 def self.notify(event, message_text) f=File.open(File.join(file_dir,'gaddy_notification.log'), 'a') f.write "#{event['event_time'].strftime('%Y-%m-%d %H:%M')} #{event['type']} #{message_text}\n" f.fsync f.close end
text_in_log_file(message)
click to toggle source
This will check if the text is already in the log file
# File lib/gaddygaddy-client/notification/file_notification.rb, line 36 def self.text_in_log_file message log_file=File.join(file_dir,'gaddy_notification.log') `/bin/grep '#{message}' #{log_file} `.strip.length > 0 end