module Thin::Logging
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+.
Attributes
debug[W]
silent[W]
trace[W]
Public Class Methods
debug(msg=nil) { || ... }
click to toggle source
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
debug?()
click to toggle source
# File lib/thin/logging.rb, line 14 def debug?; !@silent && @debug end
log(msg)
click to toggle source
Log a message to the console
# File lib/thin/logging.rb, line 27 def log(msg) puts msg unless Logging.silent? end
log_error(e=$!)
click to toggle source
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
silent?()
click to toggle source
# File lib/thin/logging.rb, line 15 def silent?; @silent end
trace(msg=nil) { || ... }
click to toggle source
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
trace?()
click to toggle source
# File lib/thin/logging.rb, line 13 def trace?; !@silent && @trace end
Public Instance Methods
debug(msg=nil) { || ... }
click to toggle source
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(msg)
click to toggle source
Log a message to the console
# File lib/thin/logging.rb, line 27 def log(msg) puts msg unless Logging.silent? end
log_error(e=$!)
click to toggle source
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
silent()
click to toggle source
Global silencer methods
# File lib/thin/logging.rb, line 19 def silent Logging.silent? end
silent=(value)
click to toggle source
# File lib/thin/logging.rb, line 22 def silent=(value) Logging.silent = value end
trace(msg=nil) { || ... }
click to toggle source
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