License: | Ruby’s license (see the LICENSE file) or GNU GPL, at your option. |
Website::http://home.gna.org/xmpp4r/
XMPP4R_VERSION | = | '0.2' | XMPP4R Version number |
returns true if debugging mode is enabled. If you just want to log something if debugging is enabled, use Jabber::debuglog instead.
# File lib/xmpp4r/debuglog.rb, line 21 21: def Jabber::debug 22: @@debug 23: end
Enable/disable debugging mode. When debug mode is enabled, information can be logged using Jabber::debuglog. When debug mode is disabled, calls to Jabber::debuglog are just ignored.
# File lib/xmpp4r/debuglog.rb, line 12 12: def Jabber::debug=(debug) 13: @@debug = debug 14: if @@debug 15: debuglog('Debugging mode enabled.') 16: end 17: end
Outputs a string only if debugging mode is enabled. If the string includes several lines, 4 spaces are added at the begginning of each line but the first one. Time is prepended to the string.
# File lib/xmpp4r/debuglog.rb, line 28 28: def Jabber::debuglog(string) 29: return if not @@debug 30: s = string.chomp.gsub("\n", "\n ") 31: t = Time::new.strftime('%H:%M:%S') 32: puts "#{t} #{s}" 33: end