Module: Yarn::Logging
- Included in:
- AbstractHandler, DirectoryLister, Server
- 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}" if $debug end |
#log(msg) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/yarn/logging.rb', line 6 def log(msg) return nil unless $log if msg.respond_to?(:each) msg.each do |line| output.puts "#{} #{line}" end else output.puts "#{} #{msg}" end end |
#output ⇒ Object
21 22 23 24 |
# File 'lib/yarn/logging.rb', line 21 def output out ||= $output || $stdout out end |
#timestamp ⇒ Object
26 27 28 29 |
# File 'lib/yarn/logging.rb', line 26 def current_time = DateTime.now "#{current_time.strftime("%d/%m/%y %H:%M:%S")} -" end |