Module: RubyRest::ApplicationLogger

Included in:
AbstractApplication
Defined in:
lib/rubyrest/application.rb

Overview

Logger configuration, can be reused in RubyRest and Non RubyRest applications

Instance Method Summary collapse

Instance Method Details

#init_loggerObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rubyrest/application.rb', line 6

def init_logger
  case @config[:deploy_mode]
    when "dev"
      @logger = Logger.new( STDOUT ) 
      @logger.level = Logger::DEBUG
    when "live"
      raise "you need to specify a logfile when deploying in LIVE mode" if !@config[:log]
      @logger = Logger.new( @config[:log], 10, 1024000 ) 
      @logger.level = Logger::ERROR
    else
      @logger = Logger.new( STDOUT ) 
      @logger.level = Logger::DEBUG
  end
  @logger.info "log level set to #{@logger.level} [OK]" if @logger.info?
end