class VarietyFormat::Logger

Constants

DEFAULT_FORMAT

format type

JSON_FORMAT
LTSV_FORMAT

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/variety_format/logger.rb, line 8
def initialize(*)
  super
  self.format_type = DEFAULT_FORMAT
end

Public Instance Methods

format_type=(value) click to toggle source
# File lib/variety_format/logger.rb, line 13
def format_type=(value)
  @format_type = value
  @formatter = pick_formatter(@format_type)
end

Private Instance Methods

pick_formatter(type) click to toggle source
# File lib/variety_format/logger.rb, line 20
def pick_formatter(type)
  formatter = select_formatter_class(type)
  formatter.new
end
select_formatter_class(type) click to toggle source
# File lib/variety_format/logger.rb, line 25
def select_formatter_class(type)
  case type
  when JSON_FORMAT
    VarietyFormat::JSONFormatter
  when LTSV_FORMAT
    VarietyFormat::LTSVFormatter
  else
    ::Logger::Formatter
  end
end