To be included in classes to allow some basic logging that can be silenced
(Logging.silent=
) or made more verbose.
Logging.debug=
: log all error backtrace and messages
logged with +debug+.
Logging.trace=
: log all raw request and response and
messages logged with +trace+.
Log a message to the console if debugging is activated
# File lib/thin/logging.rb, line 41 def debug(msg=nil) log msg || yield if Logging.debug? end
# File lib/thin/logging.rb, line 14 def debug?; !@silent && @debug end
Log a message to the console
# File lib/thin/logging.rb, line 27 def log(msg) puts msg unless Logging.silent? end
Log an error backtrace if debugging is activated
# File lib/thin/logging.rb, line 48 def log_error(e=$!) STDERR.print("#{e}\n\t" + e.backtrace.join("\n\t") + "\n") if Logging.debug? end
# File lib/thin/logging.rb, line 15 def silent?; @silent end
Log a message to the console if tracing is activated
# File lib/thin/logging.rb, line 34 def trace(msg=nil) log msg || yield if Logging.trace? end
# File lib/thin/logging.rb, line 13 def trace?; !@silent && @trace end
Log a message to the console if debugging is activated
# File lib/thin/logging.rb, line 41 def debug(msg=nil) log msg || yield if Logging.debug? end
Log a message to the console
# File lib/thin/logging.rb, line 27 def log(msg) puts msg unless Logging.silent? end
Log an error backtrace if debugging is activated
# File lib/thin/logging.rb, line 48 def log_error(e=$!) STDERR.print("#{e}\n\t" + e.backtrace.join("\n\t") + "\n") if Logging.debug? end
Global silencer methods
# File lib/thin/logging.rb, line 19 def silent Logging.silent? end
# File lib/thin/logging.rb, line 22 def silent=(value) Logging.silent = value end
Log a message to the console if tracing is activated
# File lib/thin/logging.rb, line 34 def trace(msg=nil) log msg || yield if Logging.trace? end