Module Rufus::Verbs::VerboseMixin

  1. lib/rufus/verbs/verbose.rb

Methods for the verbose mode

Methods

protected instance

  1. vlog
  2. vlog_http
  3. vlog_request
  4. vlog_response

Protected instance methods

vlog (opts, msg)

logs a unique message to the verbose channel (if any).

[show source]
    # File lib/rufus/verbs/verbose.rb, line 39
39:     def vlog (opts, msg)
40: 
41:       channel = get_channel(opts) or return
42: 
43:       channel << msg
44:     end
vlog_http (opts, http)
[show source]
    # File lib/rufus/verbs/verbose.rb, line 62
62:     def vlog_http (opts, http)
63: 
64:       channel = get_channel(opts) or return
65: 
66:       channel << "* #{http.address}:#{http.port}\n"
67:       channel << "*\n"
68:     end
vlog_request (opts, req)

logs the outgoing request

[show source]
    # File lib/rufus/verbs/verbose.rb, line 49
49:     def vlog_request (opts, req)
50: 
51:       channel = get_channel(opts) or return
52: 
53:       channel << "> #{req.method} #{req.path}\n"
54: 
55:       req.each do |k, v|
56:         channel << "> #{k}: #{v}\n"
57:       end
58: 
59:       channel << ">\n"
60:     end
vlog_response (opts, res)

logs the incoming response

[show source]
    # File lib/rufus/verbs/verbose.rb, line 73
73:     def vlog_response (opts, res)
74: 
75:       channel = get_channel(opts) or return
76: 
77:       channel << "< #{res.code} #{res.message}\n"
78:       channel << "<\n"
79: 
80:       res.each do |k, v|
81:         channel << "< #{k}: #{v}\n"
82:       end
83: 
84:       channel << "<\n"
85:     end