Module: BindLogAnalyzer::LogUtils

Included in:
Base
Defined in:
lib/bind_log_analyzer/log_utils.rb

Overview

Sets log level

Class Method Summary collapse

Class Method Details

.set_log_level(log_level) ⇒ Object

Sets the log level

Parameters:

  • logfile (String)

    The path to the file containing the Bind’s logs to analyze



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bind_log_analyzer/log_utils.rb', line 9

def self.set_log_level(log_level)
  log = Logger.new STDOUT

  if log_level > 0
    
    log_level_class = {
      1 => Logger::ERROR,
      2 => Logger::WARN,
      3 => Logger::INFO,
      4 => Logger::DEBUG
    }

    log.level = log_level_class[log_level]
  else
    log.level = Logger::FATAL
  end
  return log
end