class Pluslogger

Public Class Methods

get_pretty_trace(thread = Thread.current) click to toggle source
# File lib/pluslog.rb, line 20
def self.get_pretty_trace(thread = Thread.current)
  thread[:log_buffer]
end
log(string) click to toggle source
# 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) click to toggle source
# 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