Allow log_tags to accept a hash

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Allow log_tags to accept a hash

Anthony Ross-2
Tagged loggers like ActiveSupport::TaggedLogger make logging both named and unnamed tags visible for better application debugging. Currently log_tags only supported an array of tags such as:


config.log_tags = [
  :remote_ip,
  ->(request) { some_computed_value }
]


However as this list gets long it has two issues:

1.  Parsing JSON logs requires positional references (ie remote_ip will
always be at some index)
2.  Some tags look similar and are hard to discern in a log message.
For example a datadog trace id and epoch time look indistinguishable to a
human reading those logs

I submitted https://github.com/rails/rails/pull/38009 as one solution

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/a7992cc5-24f7-4573-ac1e-0436e2c9940a%40googlegroups.com.