module Config::Factory

Constants

The copyright notice for this gem

NAME

The name of this gem

VERSION

The version of this gem

Attributes

log[W]

Public Class Methods

included(base) click to toggle source
# File lib/config/factory/abstract_factory.rb, line 8
def self.included(base)
  base.extend(AbstractFactory)
end
log() click to toggle source

Gets the logger for the module. Default logger logs to `$stdout`. @return [Logger] the logger

# File lib/config/factory/log.rb, line 14
def self.log
  self.log_device = $stdout unless @log
  @log
end
log_device=(value) click to toggle source

Sets the log device. Defaults to `$stdout` @param value [IO] the log device

# File lib/config/factory/log.rb, line 21
def self.log_device=(value)
  @log = new_logger(logdev: value)
end

Private Class Methods

new_logger(logdev:, level: Logger::DEBUG, shift_age: 10, shift_size: 1024 * 1024) click to toggle source
# File lib/config/factory/log.rb, line 25
def self.new_logger(logdev:, level: Logger::DEBUG, shift_age: 10, shift_size: 1024 * 1024)
  logger = Logger.new(logdev, shift_age, shift_size)
  logger.level = level
  logger.formatter = proc do |severity, datetime, progname, msg|
    "#{datetime.to_time.utc} #{severity} -#{progname}- #{msg}\n"
  end
  logger
end

Public Instance Methods

env_name() click to toggle source
# File lib/config/factory/abstract_factory.rb, line 12
def env_name
  @env_name ||= Environments::DEFAULT_ENVIRONMENT
end