class WhirledPeas::Config

Constants

DEFAULT_FORMATTER

This formatter expects a loggers to send `progname` in each log call. This value should be an all uppercase version of the module or class that is invoking the logger. Ruby's logger supports setting this value on a per-log statement basis when the log message is passed in through a block:

logger.<level>(progname, &block)

E.g.

class Foo
  def bar
    logger.warn('FOO') { 'Something fishy happened in #bar' }
  end
end

The block format also has the advantage that the evaluation of the block only occurs if the message gets logged. So expensive to calculate debug statements will not impact the performance of the application if the log level is INFO or higher.

DEFAULT_LOG_FILE
DEFAULT_LOG_LEVEL

Attributes

application[W]
log_file[W]
log_formatter[W]
log_level[W]
template_factory[W]

Public Instance Methods

application() click to toggle source
# File lib/whirled_peas/config.rb, line 37
def application
  unless @application
    raise ConfigurationError, 'application must be configured'
  end
  @application
end
log_file() click to toggle source
# File lib/whirled_peas/config.rb, line 59
def log_file
  @log_file || DEFAULT_LOG_FILE
end
log_formatter() click to toggle source
# File lib/whirled_peas/config.rb, line 55
def log_formatter
  @log_formatter || DEFAULT_FORMATTER
end
log_level() click to toggle source
# File lib/whirled_peas/config.rb, line 51
def log_level
  @log_level || DEFAULT_LOG_LEVEL
end
template_factory() click to toggle source
# File lib/whirled_peas/config.rb, line 44
def template_factory
  unless @template_factory
    raise ConfigurationError, 'template_factory must be configured'
  end
  @template_factory
end