Class: Kitchen::Logger

Inherits:
Object
  • Object
show all
Includes:
Logger::Severity
Defined in:
lib/kitchen/logger.rb

Overview

Logging implementation for Kitchen. By default the console/stdout output will be displayed differently than the file log output. Therefor, this class wraps multiple loggers that conform to the stdlib Logger class behavior.

Author:

Defined Under Namespace

Classes: LogdevLogger, StdoutLogger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Logger

Returns a new instance of Logger.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/kitchen/logger.rb', line 36

def initialize(options = {})
  color = options[:color]

  @loggers = []
  @loggers << @logdev = logdev_logger(options[:logdev]) if options[:logdev]
  @loggers << stdout_logger(options[:stdout], color) if options[:stdout]
  @loggers << stdout_logger(STDOUT, color) if @loggers.empty?

  self.progname = options[:progname] || "Kitchen"
  self.level = options[:level] || default_log_level
end

Instance Attribute Details

#logdevObject (readonly)

Returns the value of attribute logdev.



34
35
36
# File 'lib/kitchen/logger.rb', line 34

def logdev
  @logdev
end