Class: Codestrap::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/codestrap/log.rb

Overview

Logging with pre set error messages

The Log class has been designed to keep track of all possible messages the program will generate

Constant Summary collapse

@@msgs =
{
    STRAPMISSING:     Proc.new { |*args| sprintf %q[Could not find project "%s".], *args },
    STUBMISSING:      Proc.new { |*args| sprintf %q[Could not find template "%s".], *args },
    NOPATH:           Proc.new { |*args| sprintf %q[No path to "%s".], *args },
    LINKTARGET:       Proc.new { |*args| sprintf %q[Invalid link target "%s". The link target must be the "%s" command], *args },
    INVALIDCMD:       Proc.new { |*args| sprintf %q[Invalid command "%s".], *args },
    FILEEXISTS:       Proc.new { |*args| sprintf %q[File "%s" exists. Can not overwrite.], *args },
    GENERATE_NOTLINK: Proc.new { |*args| sprintf %q[File "%s" is not a symlink.], *args },
}

Instance Method Summary collapse

Instance Method Details

#debug(msg, *args) ⇒ Object

Log pre set error message



52
53
54
# File 'lib/codestrap/log.rb', line 52

def debug(msg, *args)
  puts @@msgs[msg].call(*args)
end

#error(msg, *args) ⇒ Object

Log pre set error message



28
29
30
# File 'lib/codestrap/log.rb', line 28

def error(msg, *args)
  puts @@msgs[msg].call(*args)
end

#fatal(msg, *args) ⇒ Object

Log pre set fatal message



20
21
22
# File 'lib/codestrap/log.rb', line 20

def fatal(msg, *args)
  puts @@msgs[msg].call(*args)
end

#info(msg, *args) ⇒ Object

Log pre set error message



44
45
46
# File 'lib/codestrap/log.rb', line 44

def info(msg, *args)
  puts @@msgs[msg].call(*args)
end

#warn(msg, *args) ⇒ Object

Log pre set error message



36
37
38
# File 'lib/codestrap/log.rb', line 36

def warn(msg, *args)
  puts @@msgs[msg].call(*args)
end