Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
TaggedLogging to return a new logger instance #27792
I have a small question and what is better than a PR to discuss it.
The changes in here would clone the logger received in argument (and the associated formatter that
The associated test is what made me really confused the first time I hit the original behaviour.
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @arthurnn (or someone else) soon.
If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.
This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.
Please see the contribution instructions for more information.
My thought of chain on this is when calling
I think it's a fair concern, and to some extent I would consider setting my
I think it would be possible to come up with a mutating method that is not named
Definitely (it's a new instance after all, unless
But once again, I think this is expected from a method that is called
As proposed up there, if one was to use a lot of tagged logging in his application, I think it would be fair to consider setting it as the default logger.
In the cases where I wanted to use tagged logging, the desired behaviour was to do a
Eg.: A fairly simple example
class Object def method_a logger = ActiveSupport::TaggedLogging.new(Rails.logger) logger.tagged("BCX") do logger.info "something" # I expected this to be tagged method_b end end def method_b Rails.logger.info "something else" # I do not expect this to be tagged end end