module GoogleLogger::ControllerLogging

Public Instance Methods

google_log_params() click to toggle source

Returns params which should be logged, secret params have their value hidden before being logged

@return [Hash] params hash with secret values hidden

# File lib/google_logger/controller_logging.rb, line 25
def google_log_params
  params_to_log = params.to_unsafe_h
  GoogleLogger.deep_replace_secret_params(params_to_log)
  params_to_log
end
log_request_to_google() { || ... } click to toggle source

Logs the request and any uncaught exceptions, acts as an `around_action` filter. Exceptions are propagated so that they can be caught in the application.

# File lib/google_logger/controller_logging.rb, line 14
def log_request_to_google
  GoogleLogger.log_request(request, google_log_params)
  yield
rescue StandardError => e
  GoogleLogger.log_exception(e)
  raise
end