Add helper override for ActiveSupport::TaggedLogging
Closed this issue · 0 comments
jebentier commented
Is your feature request related to a problem? Please describe.
When using this with rails and ActiveSupport::TaggedLogging, the tagged logging code intercepts the log message with context hash and turns it into a string before passing it to the formatter proc.
Describe the solution you'd like
I would like there to be an additional Mixin to gracefully handle this.
Describe alternatives you've considered
I've already done a monkey-patch in my code to get this working, but think this will be a common issue with utilizing this gem, and should be added to the core.
Additional context
Here is the monkey patch code I used.
module ActiveSupport
module TaggedLogging
module Formatter
def call(severity, timestamp, progname, msg)
msg_with_tags = case msg
when Hash
msg.merge({ log_tags: tags_text })
else
"#{tags_text}#{msg}"
end
super(severity, timestamp, progname, msg_with_tags)
end
end
end
end