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