-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Allow setting formatter for Zend\Log\Writer\Db via config options #5882
Conversation
Only issue I see with this PR is it is adding additional methods that are not defined in This will primarily have an impact on the test cases, as you'll need to use reflection to alter the visibility for purposes of the tests; alternately, we can rely on known behaviors to verify that the correct functionality is being invoked. |
I made the methods |
@Martin-P The problem, though, is that (a) the methods are only visible in this single adapter, and (b) we cannot add methods to existing interfaces without breaking backwards compatibility. I'll change the visibility during merge, and update the tests. |
Allow setting formatter for Zend\Log\Writer\Db via config options
- `(get|has)Formatter()` are not part of the `WriterInterface`, and are primarily internal implementation details. Made them protected, and adjusted tests to use reflection to make them accessible in order to test internal state.
Merged to develop for release with 2.3.0. |
The methods |
…ue-5881 Allow setting formatter for Zend\Log\Writer\Db via config options
- `(get|has)Formatter()` are not part of the `WriterInterface`, and are primarily internal implementation details. Made them protected, and adjusted tests to use reflection to make them accessible in order to test internal state.
This PR fixes issue #5881 and makes it possible to set a formatter in
Zend\Log\Writer\Db
via the config options.The last line in
Zend\Log\Writer\Db::__construct()
(line 90) always sets the formatter like this:This PR has an additional check to see if there already is a formatter set which is provided via the config options. If there already is a formatter, that formatter has precedence over the default formatter. If no formatter is provided via the config options the default formatter
Zend\Log\Formatter\Db
(DbFormatter
in the code above) will be used.