Class: Gonzui::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out = nil, verbose_p = false) ⇒ Logger

Returns a new instance of Logger.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gonzui/logger.rb', line 15

def initialize(out = nil, verbose_p = false)
  @verbose_p = verbose_p
  @out = case out
         when String
           File.open(out, "a")
         when NilClass
           STDERR
         else
           out
         end
  @out.sync = true
  @monitor = nil
end

Instance Attribute Details

#monitor=(value) ⇒ Object (writeonly)

Sets the attribute monitor

Parameters:

  • value

    the value to set the attribute monitor to.



28
29
30
# File 'lib/gonzui/logger.rb', line 28

def monitor=(value)
  @monitor = value
end

Instance Method Details

#log(format, *arguments) ⇒ Object



40
41
42
# File 'lib/gonzui/logger.rb', line 40

def log(format, *arguments)
  puts_log(format, *arguments)
end

#vlog(format, *arguments) ⇒ Object



44
45
46
# File 'lib/gonzui/logger.rb', line 44

def vlog(format, *arguments)
  puts_log(format, *arguments) if @verbose_p
end