Class: Empp::EmppLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/empp/empp_logger.rb

Constant Summary collapse

@@loggerfolder =
File.expand_path(File.dirname(__FILE__)) + "/log"
@@loggerfile =
@@loggerfolder + '/empp.log'
@@loggerlevel =
Logger::DEBUG
@@logger =
nil

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEmppLogger

Returns a new instance of EmppLogger.



35
36
37
38
39
40
41
# File 'lib/empp/empp_logger.rb', line 35

def initialize
  # super(File.dirname(__FILE__) + "/log/empp.log", shift_age = 7, shift_size = 1024*1024 )
  super(@@loggerfile, shift_age = 7, shift_size = 1024*1024 )
  # super(Empp::logfile, shift_age = 7, shift_size = 1024*1024 )
  # @level = Empp::loglevel
  @level = @@loggerlevel
end

Class Method Details

.config(config = {}) ⇒ Object



16
17
18
19
20
# File 'lib/empp/empp_logger.rb', line 16

def self.config(config = {})
  @@loggerfile = config[:logfile] || @@loggerfile
  @@loggerlevel = config[:loglevel] || @@loggerlevel
  @@logger = config[:logger]
end

.instanceObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/empp/empp_logger.rb', line 22

def self.instance
  if @@logger
    return @@logger
  else
    if !File::exist?@@loggerfolder
      Dir::mkdir @@loggerfolder
    end
    @@logger = self.new
    return @@logger
  end
  
end