Module: SqsPoller::Logger

Defined in:
lib/sqspoller/logger/logger.rb

Class Method Summary collapse

Class Method Details

.get_loggerObject



31
32
33
34
35
36
# File 'lib/sqspoller/logger/logger.rb', line 31

def get_logger
  if @logger.nil?
    @logger = get_new_logger
  end
  @logger
end

.get_new_logger(prog_name = nil, log_level = nil) ⇒ Object



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

def get_new_logger (prog_name = nil, log_level = nil)
  if @logger_file.nil?
    logger = ::Logger.new(STDOUT)
  else
    logger = ::Logger.new(@logger_file)
  end
  @log_level = @log_level || ::Logger::ERROR
  logger.level = log_level || @log_level
  logger.progname = prog_name
  logger
end

.set_log_level(log_level) ⇒ Object



23
24
25
# File 'lib/sqspoller/logger/logger.rb', line 23

def set_log_level (log_level)
  @log_level = log_level
end

.set_logger_file(logger_file) ⇒ Object



27
28
29
# File 'lib/sqspoller/logger/logger.rb', line 27

def set_logger_file (logger_file)
  @logger_file = logger_file
end