Class: PCP::SimpleLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/pcp/simple_logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ SimpleLogger

Returns a new instance of SimpleLogger.


7
8
9
# File 'lib/pcp/simple_logger.rb', line 7

def initialize(*args)
  @events = []
end

Instance Method Details

#add(severity, message = nil, progname = nil) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pcp/simple_logger.rb', line 11

def add(severity, message = nil, progname = nil)
  if message.nil?
    if block_given?
      message = yield
    else
      message = progname
    end
  end

  @events << {:when => Time.now.to_f,
              :severity => severity,
              :message => message}
end