Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Hotfix BC for extra in Log\Formatter\Simple #2260

Merged
merged 8 commits into from Aug 30, 2012

Conversation

Projects
None yet
3 participants
Contributor

b-durand commented Aug 29, 2012

Hello folks 😃

ZF2 key is extra, Simple Formatter uses the legacy (ZF1) key (= info). It is not functional with Logger class.

The refactor introduces a base formatter in order to normalize in string value all non-scalar data in extra array.
I made the choice to use the json_encode instead of var_export for arrays, and objects. I think we should keep consistency for the message in Logger when it's an array.

We can update others formatters to avoid the errors of a backend with a variable type (like an instance of DateTime, a resource, etc).

Greetings.

b-durand added some commits Aug 24, 2012

@b-durand b-durand Fix coding standard 59c88c0
@b-durand b-durand Fix BC for extra in Simple Formatter
ZF2 key is 'extra', Simple Formatter uses the legacy (ZF1) key (=
'info'). It is not functional with Logger.

The refactor introduces a base formatter in order to normalize in string
value all non-scalar data in extra array.
25ea76f
@b-durand b-durand Refactor test complex messages with a dataprovider eb6ec20
@b-durand b-durand Improve the coverage of tests for SimpleFormatter
We can modify the format of the output with an argument in the
constructor.
392ac44
@b-durand b-durand Add unit tests for BaseFormatter
We keep the type array for the extra of the event, because some writers
may use extra as one dimension with a double key (like the DbWriter).

I fixed the use case Iterators: the goal is to have the same JSON encoding as array.
8c902a8
@b-durand b-durand Clean duplicate code in SimpleFormatter 6cf7ab3
@b-durand b-durand Fix issue for SimpleFormatter when extra is empty
We have the same issue as the XmlFormatter in ZF2-453. We don't know to
write an empty array when the extra is not used by an event.
284ed37
@b-durand b-durand Clean up duplicate tests in Log\SimpleFormatter
All variable types are already tested since SimpleFormatter extends BaseFormatter.
1b75f89

This pull request passes (merged 1b75f89 into 1736dd0).

@weierophinney weierophinney added a commit that referenced this pull request Aug 30, 2012

@weierophinney weierophinney [#2260] Updated README
- Noted changes in logger
4bd9b36

@weierophinney weierophinney merged commit 1b75f89 into zendframework:master Aug 30, 2012

Owner

weierophinney commented Aug 30, 2012

Merged to 2.0.0, 2.0.1, and master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment