Class: Pluslogger
Class Method Summary collapse
Class Method Details
.get_pretty_trace(thread = Thread.current) ⇒ Object
20 21 22 |
# File 'lib/pluslog.rb', line 20 def self.get_pretty_trace(thread = Thread.current) thread[:log_buffer] end |
.log(string) ⇒ Object
24 25 26 27 28 |
# File 'lib/pluslog.rb', line 24 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
30 31 32 33 34 35 36 |
# File 'lib/pluslog.rb', line 30 def self.new(&block) Thread.current[:depth] ||= 0 Thread.current[:depth] += 1 res = block.call Thread.current[:depth] -= 1 res end |