Class: ChromeLogger::Console
- Inherits:
-
Object
- Object
- ChromeLogger::Console
- Defined in:
- lib/chrome_logger/console.rb
Instance Attribute Summary collapse
-
#log_items ⇒ Object
readonly
Returns the value of attribute log_items.
Class Method Summary collapse
Instance Method Summary collapse
- #add_log_items(level, *args) ⇒ Object
- #data ⇒ Object
-
#initialize ⇒ Console
constructor
A new instance of Console.
-
#log(*args) ⇒ Object
custom to let chrome plugin decide default.
Constructor Details
#initialize ⇒ Console
Returns a new instance of Console.
15 16 17 |
# File 'lib/chrome_logger/console.rb', line 15 def initialize @log_items = [] end |
Instance Attribute Details
#log_items ⇒ Object (readonly)
Returns the value of attribute log_items.
3 4 5 |
# File 'lib/chrome_logger/console.rb', line 3 def log_items @log_items end |
Class Method Details
.logger_for(*kinds) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/chrome_logger/console.rb', line 5 def self.logger_for( *kinds ) kinds.each do | kind | class_eval <<-___ def #{ kind }( *args ) add_log_items '#{ kind }' , *args end ___ end end |
Instance Method Details
#add_log_items(level, *args) ⇒ Object
19 20 21 22 23 |
# File 'lib/chrome_logger/console.rb', line 19 def add_log_items( level , *args ) backtrace = caller[ 1 ] # 2 up! item = [ args , backtrace , level ] @log_items << item end |
#data ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/chrome_logger/console.rb', line 25 def data { 'version' => ChromeLogger::VERSION, 'columns' => [ 'log' , 'backtrace' , 'type' ], 'rows' => log_items } end |
#log(*args) ⇒ Object
custom to let chrome plugin decide default
45 46 47 |
# File 'lib/chrome_logger/console.rb', line 45 def log( *args ) add_log_items '' , *args end |