class SystemdMon::Notifiers::Base

Attributes

me[RW]
options[RW]

Public Class Methods

new(options) click to toggle source
# File lib/systemd_mon/notifiers/base.rb, line 5
def initialize(options)
  self.options = options
  self.me      = self.class.name
end

Public Instance Methods

debug(message = nil, &blk) click to toggle source
# File lib/systemd_mon/notifiers/base.rb, line 31
def debug(message = nil, &blk)
  message = "#{me}: #{message}" if message
  SystemdMon::Logger.debug message, &blk
end
log(message) click to toggle source

Subclasses can choose to do something when SystemdMon stops E.g. with

def notify_stop!(hostname) end

# File lib/systemd_mon/notifiers/base.rb, line 27
def log(message)
  SystemdMon::Logger.puts "#{me}: #{message}"
end
notify!(notification) click to toggle source

Subclasses must respond to a unit change

# File lib/systemd_mon/notifiers/base.rb, line 11
def notify!(notification)
  raise "Notifier #{self.class} does not respond to notify!"
end