Class: Collector::Plus_log
- Inherits:
-
Object
- Object
- Collector::Plus_log
- Defined in:
- lib/plus_log.rb
Class Method Summary collapse
Class Method Details
.get_pretty_trace(thread = Thread.current) ⇒ Object
21 22 23 |
# File 'lib/plus_log.rb', line 21 def self.get_pretty_trace(thread = Thread.current) thread[:log_buffer] end |
.log(string) ⇒ Object
25 26 27 28 29 |
# File 'lib/plus_log.rb', line 25 def self.log(string) Thread.current[:log_buffer] ||= "" depth = Thread.current[:depth] || 0 Thread.current[:log_buffer] += "#{'| ' * depth}#{string} [#{Time.now}]\n" end |
.new(&block) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/plus_log.rb', line 31 def self.new(&block) Thread.current[:depth] ||= 0 Thread.current[:depth] += 1 res = block.call Thread.current[:depth] -= 1 res end |