Class: Pacproxy::GeneralLogger

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/pacproxy/general_logger.rb

Overview

Provide log Function

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGeneralLogger

Returns a new instance of GeneralLogger.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pacproxy/general_logger.rb', line 11

def initialize
  c = Config.instance.config['general_log']
  return @logger = nil unless c

  location = c['location'] ? c['location'] : STDOUT
  shift_age = c['shift_age'] ? c['shift_age'] : 0
  shift_size = c['shift_size'] ? c['shift_size'] : 1_048_576
  @logger = Logger.new(location, shift_age, shift_size)
  @logger.level = c['log_level'] ? Logger.const_get(c['log_level']) : Logger::ERROR
  @logger.progname = 'pacproxy'
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



9
10
11
# File 'lib/pacproxy/general_logger.rb', line 9

def logger
  @logger
end