Sha256: 215b764cfafce74bdfbc465dd46d02ecc785acdcd49a55d53c6dc1119b69f7a4

Contents?: true

Size: 834 Bytes

Versions: 6

Compression:

Stored size: 834 Bytes

Contents

#--
# Configure logging
#++
include Log4r

log_dir_loc = File.join(Mack::Configuration.root, "log")
FileUtils.mkdir_p(log_dir_loc)

unless Object.const_defined?("MACK_DEFAULT_LOGGER")
  log = Log4r::Logger.new('')
  log.level =  Module.instance_eval("Log4r::#{app_config.log.level.to_s.upcase}")
  # console:
  if app_config.log.console
    console_format = PatternFormatter.new(:pattern => app_config.log.console_format)
    log.add(Log4r::StdoutOutputter.new('console', :formatter => console_format))
  end
  # file:
  if app_config.log.file
    file_format = PatternFormatter.new(:pattern => app_config.log.file_format)
    log.add(FileOutputter.new('fileOutputter', :filename => File.join(log_dir_loc, "#{Mack::Configuration.env}.log"), :trunc => false, :formatter => file_format))
  end
  
  Object::MACK_DEFAULT_LOGGER = log
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mack-0.5.0 lib/initialization/initializers/logging.rb
mack-0.5.5.1 lib/initialization/logging.rb
mack-0.5.5.2 lib/initialization/logging.rb
mack-0.5.5.3 lib/initialization/logging.rb
mack-0.5.5.4 lib/initialization/logging.rb
mack-0.5.5 lib/initialization/logging.rb