Class: Bricolage::Logger
- Inherits:
-
Logger
- Object
- Logger
- Bricolage::Logger
- Defined in:
- lib/bricolage/logger.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#elapsed_time(label, t) ⇒ Object
33 34 35 |
# File 'lib/bricolage/logger.rb', line 33 def elapsed_time(label, t) info "#{label}#{pretty_interval(t)}" end |
#exception(ex) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/bricolage/logger.rb', line 15 def exception(ex) buf = StringIO.new buf.puts "#{ex.class}: #{ex.}" ex.backtrace.each do |trace| buf.puts "\t" + trace end error buf.string end |
#with_elapsed_time(label = '') ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/bricolage/logger.rb', line 24 def with_elapsed_time(label = '') start_time = Time.now begin return yield ensure elapsed_time(label, Time.now - start_time) end end |