Module: Yarn::Logging
- Included in:
- DirectoryLister, RequestHandler, Server, WorkerPool
- Defined in:
- lib/yarn/logging.rb
Instance Method Summary collapse
Instance Method Details
#debug(msg = nil) ⇒ Object
17 18 19 |
# File 'lib/yarn/logging.rb', line 17 def debug(msg=nil) log "DEBUG: #{msg || yield}" end |
#log(msg) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/yarn/logging.rb', line 7 def log(msg) if msg.respond_to?(:each) msg.each do |line| output.puts "#{} #{line}" end else output.puts "#{} #{msg}" end end |
#output ⇒ Object
21 22 23 |
# File 'lib/yarn/logging.rb', line 21 def output $output || $stdout end |
#timestamp ⇒ Object
25 26 27 28 |
# File 'lib/yarn/logging.rb', line 25 def current_time = DateTime.now "#{current_time.strftime("%d/%m/%y %H:%M:%S")} -" end |