Class: Sinew::Middleware::LogFormatter

Inherits:
Faraday::Logging::Formatter
  • Object
show all
Defined in:
lib/sinew/middleware/log_formatter.rb

Overview

Minimalist Formatter that logs proxy if present.

Instance Method Summary collapse

Instance Method Details

#request(env) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sinew/middleware/log_formatter.rb', line 5

def request(env)
  info('req') do
    # Only log the initial request, not the redirects
    return if env[:redirect]

    msg = apply_filters(env.url.to_s)
    msg = "#{msg} (#{env.method})" if env.method != :get
    msg = "#{msg} => #{env.request.proxy.uri}" if env.request.proxy

    msg
  end
end

#response(env) ⇒ Object



18
19
20
# File 'lib/sinew/middleware/log_formatter.rb', line 18

def response(env)
  # silent
end