Module: Chef::EventLoggers

Defined in:
lib/chef/event_loggers/base.rb,
lib/chef/event_loggers/windows_eventlog.rb

Defined Under Namespace

Classes: Base, UnavailableEventLogger, UnknownEventLogger, WindowsEventLogger

Class Method Summary collapse

Class Method Details

.available_event_loggersObject



38
39
40
41
42
# File 'lib/chef/event_loggers/base.rb', line 38

def self.available_event_loggers
  event_loggers_by_name.select do |key, val|
    val.available?
  end.keys
end

.by_name(name) ⇒ Object



34
35
36
# File 'lib/chef/event_loggers/base.rb', line 34

def self.by_name(name)
  event_loggers_by_name[name]
end

.event_loggers_by_nameObject



26
27
28
# File 'lib/chef/event_loggers/base.rb', line 26

def self.event_loggers_by_name
  @event_loggers_by_name ||= {}
end

.new(name) ⇒ Object

Raises:



44
45
46
47
48
49
50
# File 'lib/chef/event_loggers/base.rb', line 44

def self.new(name)
  event_logger_class = by_name(name.to_s)
  raise UnknownEventLogger, "No event logger found for #{name} (available: #{available_event_loggers.join(", ")})" unless event_logger_class
  raise UnavailableEventLogger unless available_event_loggers.include? name.to_s

  event_logger_class.new
end

.register(name, logger) ⇒ Object



30
31
32
# File 'lib/chef/event_loggers/base.rb', line 30

def self.register(name, logger)
  event_loggers_by_name[name.to_s] = logger
end