Closed leehambley closed 4 years ago
Here is an overview of what got changed by this pull request:
Complexity increasing per file
==============================
- spec/extensions/activesupport_taggedlogging_formatter.rb 2
See the complete overview on Codacy
Thanks, I'll make a few tweaks and push a release shortly after.
ActiveSupport::TaggedLogging
usesThread.current[]=
to track log tags. ThisThread.current[]=
is however Fiber local variable (since Ruby 2.0)Compare:
https://ruby-doc.org/core-2.0.0/Thread.html#method-i-5B-5D
Attribute Reference—Returns the value of a fiber-local variable (current thread's root fiber if not explicitely inside a Fiber), using either a symbol or a string name. If the specified variable does not exist, returns nil.
https://tool.oschina.net/uploads/apidocs/ruby-1.9.3-core/Thread.html#method-i-5B-5D
Attribute Reference—Returns the value of a thread-local variable, using either a symbol or a string name. If the specified variable does not exist, returns nil.
The patch uses
#thread_variable_set
and#thread_variable_get
which are part of Ruby itself since 2.0. ActiveSupport contained shims for this in the 4.x series, they were dropped in the 5.x series when Rails adopted a minimumRUBY_VERSION
of 2.2, and thus was guaranteed access to those native implementations ofthread_varaible_{set,get}