Since version 0.7, the logworm client has three configuration options:
donot_log_requests to disable the automatic logging of web requestslog_headers to enable the logging of request and response headers with web logslog_in_development to enable logworm in development mode (normally only enabled in production)log_environments, which receives a list of strings with the names of environments in which logworm should be enabledOn Rails < 3.0.0, you configure logworm's behavior in your ApplicationController. For example, to enable logworm in development mode, and to log headers along with the basic web request information, you do:
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => 'xxxxxxxxx'
[...]
# logworm: turn it on in development mode, and log request headers with the rest of the web request info
log_in_development
log_headers
end
If you want to have logworm be enabled in 'production', 'testing', and 'staging' environments, you do:
class ApplicationController < ActionController::Base
[...]
log_environments 'production', 'testing', 'staging'
[...]
end
On Rails 3.0.0 you configure logworm's behavior in your config/application.rb, in the call to use the Logworm middleware. For example, to enable logworm in development and testing mode, and to log headers along with the basic web request information, you do:
config.middleware.use(Logworm::Rack, :log_environments => ["development", "testing"], :log_headers => true)
With Rack you configure logworm's behavior in your config.ru file, by passing a combination of the configuration parameter as options to the use Logworm::Rack directive. For example, to enable logworm in development and testing mode, and to log headers along with the basic web request information, you do:
use Logworm::Rack, :log_headers=>true, :log_environments => ["development", "testing"]