Module: Rack::Cors::CsrfPrevention::Logger

Included in:
Rack::Cors::CsrfPrevention
Defined in:
lib/rack/cors/csrf_prevention/logger.rb

Instance Method Summary collapse

Instance Method Details

#logger(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rack/cors/csrf_prevention/logger.rb', line 9

def logger(env)
  @logger = if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
              Rails.logger
            elsif env[RACK_LOGGER]
              env[RACK_LOGGER]
            else
              ::Logger.new($stdout).tap do |logger|
                logger.level = ::Logger::Severity::DEBUG
              end
            end
end