Class: Knapsack::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack/logger.rb

Constant Summary collapse

DEBUG =
0
INFO =
1
WARN =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#levelObject

Returns the value of attribute level.



3
4
5
# File 'lib/knapsack/logger.rb', line 3

def level
  @level
end

Instance Method Details

#debug(text = nil) ⇒ Object



9
10
11
12
# File 'lib/knapsack/logger.rb', line 9

def debug(text=nil)
  return if level != DEBUG
  puts text
end

#info(text = nil) ⇒ Object



14
15
16
17
# File 'lib/knapsack/logger.rb', line 14

def info(text=nil)
  return if level > INFO
  puts text
end

#warn(text = nil) ⇒ Object



19
20
21
22
# File 'lib/knapsack/logger.rb', line 19

def warn(text=nil)
  return if level > WARN
  puts text
end