Module: Kameleoon::Logging::KameleoonLogger

Extended by:
KameleoonLogger
Included in:
KameleoonLogger
Defined in:
lib/kameleoon/logging/kameleoon_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#log_levelObject

Returns the value of attribute log_level.



36
37
38
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 36

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



36
37
38
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 36

def logger
  @logger
end

Instance Method Details

#debug(data, *args) ⇒ Object



62
63
64
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 62

def debug(data, *args)
  log(LogLevel::DEBUG, data, *args)
end

#error(data, *args) ⇒ Object



54
55
56
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 54

def error(data, *args)
  log(LogLevel::ERROR, data, *args)
end

#info(data, *args) ⇒ Object



50
51
52
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 50

def info(data, *args)
  log(LogLevel::INFO, data, *args)
end

#log(level, data, *args) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 38

def log(level, data, *args)
  return unless check_level(level)

  if data.class.method_defined?(:call)
    message = data.call
  else
    message = args.empty? ? data : data % args
  end

  write_message(level, message)
end

#warning(data, *args) ⇒ Object



58
59
60
# File 'lib/kameleoon/logging/kameleoon_logger.rb', line 58

def warning(data, *args)
  log(LogLevel::WARNING, data, *args)
end