aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notifiers/debug.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-17 21:26:49 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-17 21:26:49 +0100
commit4c99233f3b3112cd2be5ab6fd5d6e7c1c344406b (patch)
treeca5a7c3659b5aa3be4ecf40af95ef24870c09e7c /lib/mauve/notifiers/debug.rb
parent3a579efcd3ea7e4362f7abeb4138c4087e6f13c1 (diff)
* The notification buffer is now used to store Alerts/AlertChangeds and times
to notify about, rather than notifications to be sent. * Fixed up the debug notifier a bit more. * Using the debug notifier extras more now.
Diffstat (limited to 'lib/mauve/notifiers/debug.rb')
-rw-r--r--lib/mauve/notifiers/debug.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/mauve/notifiers/debug.rb b/lib/mauve/notifiers/debug.rb
index 417bc94..a9afc52 100644
--- a/lib/mauve/notifiers/debug.rb
+++ b/lib/mauve/notifiers/debug.rb
@@ -53,27 +53,21 @@ module Mauve
end
def send_alert_to_debug_channels(destination, alert, all_alerts, conditions = nil)
- message = if respond_to?(:prepare_message)
+ message = if self.respond_to?(:prepare_message)
prepare_message(destination, alert, all_alerts, conditions)
else
[destination, alert, all_alerts].inspect
end
if deliver_to_file
- #lock_file = "#{deliver_to_file}.lock"
- #while File.exists?(lock_file)
- # sleep 0.1
- #end
- #FileUtils.touch(lock_file)
File.open("#{deliver_to_file}", "a+") do |fh|
fh.flock(File::LOCK_EX)
- fh.print("#{Time.now} from #{self.class}: " + message + "\n")
+ fh.print YAML.dump([Time.now, self.class, destination, message])
fh.flush()
end
- #FileUtils.rm(lock_file)
end
- deliver_to_queue << [destination, alert, all_alerts, conditions] if deliver_to_queue
+ deliver_to_queue << [Time.now, self.class, destination, message] if deliver_to_queue
if @disable_normal_delivery
true # pretend it happened OK if we're just testing