Module: Waves::Logger

Extended by:
Forwardable
Defined in:
lib/waves/runtime/logger.rb

Class Method Summary collapse

Class Method Details

.configObject

Returns the active configuration for the logger.



12
# File 'lib/waves/runtime/logger.rb', line 12

def self.config ; @config ||= Waves.config.log ; end

.levelObject

Returns the logging level used to filter logging events.



15
# File 'lib/waves/runtime/logger.rb', line 15

def self.level ; @level ||= ::Logger.const_get( config[:level].to_s.upcase || 'INFO' ) ; end

.outputObject

Returns the object being used for output by the logger.



7
8
9
# File 'lib/waves/runtime/logger.rb', line 7

def self.output
  @output ||= ( config[:output] or $stderr )
end

.startObject

Starts the logger, using the active configuration to initialize it.



18
19
20
21
22
23
24
25
# File 'lib/waves/runtime/logger.rb', line 18

def self.start
  @log = config[:rotation] ?
    ::Logger.new( output, config[:rotation].to_sym ) :
    ::Logger.new( output )
  @log.level = level
  @log.datetime_format = "%Y-%m-%d %H:%M:%S "
  self
end