class Splash::Loggers::LoggerTemplate

class template for loggers

Public Class Methods

new() click to toggle source

constructor

# File lib/splash/loggers.rb, line 66
def initialize
  self.level = get_config.loggers[:level]


end

Public Instance Methods

level() click to toggle source

getter for the current level @return [Symbol] level

# File lib/splash/loggers.rb, line 85
def level
  return @active_levels.first
end
level=(level) click to toggle source

virtual setter for level, set the current level @raise a badLevel in case of bad level @param [Symbol] level

# File lib/splash/loggers.rb, line 92
def level=(level)
  if LEVELS.include? level then
    @active_levels = LEVELS.dup
    @active_levels.shift(LEVELS.index(level))
  else
    raise BadLevel
  end
end
log(options) click to toggle source

abstract method for log wrapper @param [Hash] options @option options [Symbol] :level, a valid level in LEVELS or ALIAS @option options [String] :message text

# File lib/splash/loggers.rb, line 76
def log(options)
  level = (ALIAS.keys.include? options[:level])?  ALIAS[options[:level]] : options[:level]
  if @active_levels.include? level then
    puts options[:message]
  end
end

Private Instance Methods

alt(symbol) click to toggle source

mapper for symbol Symbol to String @param [Symbol] symbol @return [String] in upcase, exception :arrow give '=>', :flat give ''

# File lib/splash/loggers.rb, line 106
def alt(symbol)
  return "=>" if symbol == :arrow
  return '' if symbol == :flat
  return symbol.to_s.upcase
end