diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-10-19 13:24:28 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-10-19 13:24:28 -0500 |
commit | 4a4927f753d7f41c0903ab3adfb73be8490c382e (patch) | |
tree | bd4c3474d92e8b7ce889df788426ba7539c88649 /railties/lib/rails/rack/tagged_logging.rb | |
parent | afde6fdd5ef3e6b0693a7e330777e85ef4cffddb (diff) | |
download | rails-4a4927f753d7f41c0903ab3adfb73be8490c382e.tar.gz rails-4a4927f753d7f41c0903ab3adfb73be8490c382e.tar.bz2 rails-4a4927f753d7f41c0903ab3adfb73be8490c382e.zip |
Simplify TaggedLogging symbol shortcuts (thanks Jose!)
Diffstat (limited to 'railties/lib/rails/rack/tagged_logging.rb')
-rw-r--r-- | railties/lib/rails/rack/tagged_logging.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/railties/lib/rails/rack/tagged_logging.rb b/railties/lib/rails/rack/tagged_logging.rb index 7980319b37..c519d7c3e6 100644 --- a/railties/lib/rails/rack/tagged_logging.rb +++ b/railties/lib/rails/rack/tagged_logging.rb @@ -1,9 +1,8 @@ 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 the symbols :uuid or :subdomain. - # The latter two are then automatically expanded to request.uuid and request.subdaomins.first -- the two most common tags - # desired in production logs. + # 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 @@ -25,10 +24,8 @@ module Rails case tag when Proc tag.call(request) - when :uuid - request.uuid - when :subdomain - request.subdomains.first + when Symbol + request.send(tag) else tag end |