Update LoggingTranslator to log the change of a locale#31242
Merged
fabpot merged 1 commit intosymfony:masterfrom Apr 27, 2019
Merged
Update LoggingTranslator to log the change of a locale#31242fabpot merged 1 commit intosymfony:masterfrom
fabpot merged 1 commit intosymfony:masterfrom
Conversation
| { | ||
| $prev = $this->translator->getLocale(); | ||
| $this->translator->setLocale($locale); | ||
| $this->logger->debug('Translator has changed the locale.', ['previous' => $prev, 'new' => $locale]); |
Contributor
There was a problem hiding this comment.
+1 it can be usefull in dev
previous/next or old/new, here you use one of both
Member
There was a problem hiding this comment.
It'd suggest putting the locale in the message, e.g.:
The locale of the translator has changed from "%s" to "%s".
Simperfit
approved these changes
Apr 26, 2019
nicolas-grekas
approved these changes
Apr 26, 2019
fabpot
approved these changes
Apr 27, 2019
Member
|
Thank you @gmponos. |
fabpot
added a commit
that referenced
this pull request
Apr 27, 2019
… (gmponos) This PR was squashed before being merged into the 4.3-dev branch (closes #31242). Discussion ---------- Update LoggingTranslator to log the change of a locale | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT I would like to see inside my logs that the translator changed the locale. I've had a case that I spent significant amount of time trying to debug it. Commits ------- 20380f9 Update LoggingTranslator to log the change of a locale
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I would like to see inside my logs that the translator changed the locale. I've had a case that I spent significant amount of time trying to debug it.