module Roda::RodaPlugins::FilterCommonLogger

  1. lib/roda/plugins/filter_common_logger.rb

The skip_common_logger plugin allows for skipping common_logger logging of some requests. You pass a block when loading the plugin, and the block will be called before logging each request. The block should return whether the request should be logged.

Example:

# Only log server errors
plugin :filter_common_logger do |result|
  result[0] >= 500
end

# Don't log requests to certain paths
plugin :filter_common_logger do |_|
  # Block is called in the same context as the route block
  !request.path.start_with?('/admin/')
end

Methods

Public Class

  1. configure
  2. load_dependencies

Public Class methods

configure(app, &block)
[show source]
   # File lib/roda/plugins/filter_common_logger.rb
28 def self.configure(app, &block)
29   app.send(:define_method, :_common_log_request?, &block)
30   app.send(:private, :_common_log_request?)
31   app.send(:alias_method, :_common_log_request?, :_common_log_request?)
32 end
load_dependencies(app, &_)
[show source]
   # File lib/roda/plugins/filter_common_logger.rb
24 def self.load_dependencies(app, &_)
25   app.plugin :common_logger
26 end