Class: Cuprum::Rails::Actions::Middleware::LogRequest

Inherits:
Command
  • Object
show all
Includes:
Middleware
Defined in:
lib/cuprum/rails/actions/middleware/log_request.rb

Overview

Configurable middleware for logging controller requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**config) ⇒ LogRequest

Returns a new instance of LogRequest.

Parameters:

  • config (Hash)

    request and environment properties to log. A value of false will disable logging for that property.

Options Hash (**config):

  • action_name (Boolean)

    if true, logs the name of the action. Defaults to true.

  • authorization (Boolean)

    if true, logs the value of the authorization header. Defaults to false.

  • body_params (Boolean)

    if true, logs the parameters from the request body. Defaults to true.

  • controller_name (Boolean)

    if true, logs the name of the controller. Defaults to true.

  • format (Boolean)

    if true, logs the request format. Defaults to true.

  • headers (Boolean)

    if true, logs the headers. Defaults to false.

  • http_methopd (Boolean)

    if true, logs the request HTTP method. Defaults to true.

  • params (Boolean)

    if true, logs the request parameters. Defaults to true.

  • path (Boolean)

    if true, logs the request path. Defaults to true.

  • path_params (Boolean)

    if true, logs the parameters from the request path. Defaults to true.

  • query_params (Boolean)

    if true, logs the parameters from the url query. Defaults to true.

  • repository (Boolean)

    if true, logs the repository used in the request. Defaults to false.

  • resource (Boolean)

    if true, logs the resource used in the request. Defaults to false.



62
63
64
65
66
# File 'lib/cuprum/rails/actions/middleware/log_request.rb', line 62

def initialize(**config)
  super()

  @config = DEFAULT_CONFIGURATION.merge(config)
end

Instance Attribute Details

#configHash (readonly)

Returns request and environment properties to log.

Returns:

  • (Hash)

    request and environment properties to log.



69
70
71
# File 'lib/cuprum/rails/actions/middleware/log_request.rb', line 69

def config
  @config
end