class Berkshelf::Logger

def add(severity, message = nil, progname = nil, &block)

Returns:
  • (Boolean) -

Parameters:
  • &block () --
  • progname (String) -- = nil
  • message (String) -- = nil
  • severity (Fixnum) --
def add(severity, message = nil, progname = nil, &block)
  severity ||= Logger::UNKNOWN
  if @logdev.nil? || severity < (@level)
    return true
  end
  progname ||= @progname
  if message.nil?
    if block_given?
      message = yield
    else
      message = progname
      progname = @progname
    end
  end
  @logdev.write(
    format_message(format_severity(severity), Time.now, progname, filter(message))
  )
  true
end

def clear_filter_params

def clear_filter_params
  @filter_params.clear
end

def deprecate(message)

def deprecate(message)
  trace = caller.join("\n\t")
  warn "DEPRECATION WARNING: #{message}\n\t#{trace}"
end

def exception(ex)

Parameters:
  • ex (Exception) --
def exception(ex)
  fatal("#{ex.class}: #{ex}")
  fatal(ex.backtrace.join("\n")) unless ex.backtrace.nil?
end

def filter(message)

def filter(message)
  filter_params.each do |param|
    message.gsub!(param.to_s, "FILTERED")
  end
  message
end

def filter_param(param)

def filter_param(param)
  @filter_params << param unless filter_params.include?(param)
end

def filter_params

def filter_params
  @filter_params.dup
end

def initialize(device = STDOUT)

def initialize(device = STDOUT)
  super
  self.level = Logger::WARN
  @filter_params = []
end