Class: EasyProfiler::FirebugLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_prof/firebug_logger.rb

Overview

A logger used to output logs to the Firebug console.

Based on rails.aizatto.com/category/plugins/firebug-logger/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFirebugLogger

:nodoc:



8
9
10
# File 'lib/easy_prof/firebug_logger.rb', line 8

def initialize #:nodoc:
  @logs = []
end

Instance Attribute Details

#logsObject

Returns the value of attribute logs.



6
7
8
# File 'lib/easy_prof/firebug_logger.rb', line 6

def logs
  @logs
end

Instance Method Details

#clearObject

Clear the logs.



13
14
15
# File 'lib/easy_prof/firebug_logger.rb', line 13

def clear
  @logs = []
end

#info(message = nil) ⇒ Object

Adds a line to the log.

arguments

  • message – log message to be logged

  • block – optional. Return value of the block will be the message that will be logged.



22
23
24
25
# File 'lib/easy_prof/firebug_logger.rb', line 22

def info(message = nil)
  message = yield if message.nil? && block_given?
  @logs << message
end