Class: LoggerFactory

Inherits:
Object
  • Object
show all
Includes:
ConfigLoader
Defined in:
lib/stat-count-client/logger_factory.rb

Constant Summary collapse

@@logger =
nil

Class Method Summary collapse

Class Method Details

.getLogger(name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/stat-count-client/logger_factory.rb', line 10

def self.getLogger(name)
   if @@logger.nil?
     @monitor = Monitor.new
     @monitor.synchronize do
       if @@logger.nil?
         log_path = CONFIG['log.file.'+name];
         if(log_path.nil?)
            log_path = "./stat-count/Stat-count-client.log"
         end

         log_level = CONFIG['log.level.'+name]
         if(log_level.nil?)
           log_level = "error";
         end
         logger = Logger.new(log_path,'daily')
         logger.level = Logger::const_get(log_level.upcase)
         @@logger = logger;
       end
     end
   end
   @@logger
end