Class: EventLogger::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/event_logger/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
12
# File 'lib/event_logger/config.rb', line 10

def initialize
  self.logger = ENV.fetch('EVENT_LOGGER_LOGGER', :logger).to_sym
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/event_logger/config.rb', line 8

def logger
  @logger
end

Instance Method Details

#logger_instanceObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/event_logger/config.rb', line 22

def logger_instance
  if logger == :logger
    EventLogger::Output::Logger.new(Logger.new(STDOUT))
  elsif logger == :stdout
    EventLogger::Output::IO.new($stdout)
  elsif logger.respond_to?(:<<)
    EventLogger::Output::IO.new(logger)
  else
    EventLogger::Output::Logger.new(logger)
  end
end