diff options
Diffstat (limited to 'railties/lib/rails/rack/tagged_logging.rb')
-rw-r--r-- | railties/lib/rails/rack/tagged_logging.rb | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/railties/lib/rails/rack/tagged_logging.rb b/railties/lib/rails/rack/tagged_logging.rb deleted file mode 100644 index c519d7c3e6..0000000000 --- a/railties/lib/rails/rack/tagged_logging.rb +++ /dev/null @@ -1,36 +0,0 @@ -module Rails - module Rack - # Enables easy tagging of any logging activity that occurs within the Rails request cycle. The tags are configured via the - # config.log_tags setting. The tags can either be strings, procs taking a request argument, or symbols representing method - # names on request (so :uuid will result in request.uuid being added as a tag). - class TaggedLogging - def initialize(app, tags = nil) - @app, @tags = app, tags - end - - def call(env) - if @tags - Rails.logger.tagged(compute_tags(env)) { @app.call(env) } - else - @app.call(env) - end - end - - private - def compute_tags(env) - request = ActionDispatch::Request.new(env) - - @tags.collect do |tag| - case tag - when Proc - tag.call(request) - when Symbol - request.send(tag) - else - tag - end - end - end - end - end -end |