class FPM::Scriptable::Log

Attributes

color[RW]
has_error[R]
quiet[RW]

Public Class Methods

new() click to toggle source
# File lib/fpm/scriptable/log.rb, line 22
def initialize
  clobber
end

Public Instance Methods

add(level=:info, color=true, *args) click to toggle source
# File lib/fpm/scriptable/log.rb, line 40
def add(level=:info, color=true, *args)
  l = LogHandler.new(*args)
  l.level = LogHandler.level level
  l.color = color

  if @logger.nil?
    @logger = l
  else
    @logger.extend(LogHandler.broadcast(l))
  end
end
clobber() click to toggle source
# File lib/fpm/scriptable/log.rb, line 26
def clobber
  @quiet = false
  @color = true

  @logger = nil
  @has_error = false
end
debug(msg) click to toggle source
# File lib/fpm/scriptable/log.rb, line 68
def debug(msg)
  if !msg.nil?
    if !@logger.nil?
      @logger.debug msg
    end
  end
end
error(msg) click to toggle source
# File lib/fpm/scriptable/log.rb, line 76
def error(msg)
  @has_error = true
  if !msg.nil?
    if !@logger.nil?
      @logger.error msg
    end
  end
end
fatal(msg) click to toggle source
# File lib/fpm/scriptable/log.rb, line 85
def fatal(msg)
  @has_error = true
  if !msg.nil?
    if !@logger.nil?
      @logger.fatal msg
    end
  end
end
info(msg) click to toggle source
# File lib/fpm/scriptable/log.rb, line 52
def info(msg)
  if !msg.nil?
    if !@logger.nil?
      @logger.info msg
    end
  end
end
show(msg,quiet=@quiet) click to toggle source
# File lib/fpm/scriptable/log.rb, line 34
def show(msg,quiet=@quiet)
  if !msg.nil?
    puts msg unless quiet
  end
end
warn(msg) click to toggle source
# File lib/fpm/scriptable/log.rb, line 60
def warn(msg)
  if !msg.nil?
    if !@logger.nil?
      @logger.warn msg
    end
  end
end