compared with
Current by Enrico Zimuel
on Mar 12, 2012 16:10.

(show comment)
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (17)

View Page History
h2. Feedbacks/issues of Zend_Log for ZF1
<h2>Feedbacks/issues of Zend_Log for ZF1</h2>


* More flexible mapping ror Zend_Log_Writer_Db [ZF-2658 | http://framework.zend.com/issues/browse/ZF-2658]
* Zend_Log_Formatter_Simple must print %info% event [ZF-10427 | http://framework.zend.com/issues/browse/ZF-10427]
* Incorrect handling of E_DEPRECATED and E_USER_DEPRECATED [ZF-12031 | http://framework.zend.com/issues/browse/ZF-12031]
* Patch to make line and file information available in log events [ZF-2428 | http://framework.zend.com/issues/browse/ZF-2428]
* Add Zend_Log::getWriters() to return list of attached writers [ZF-3581 | http://framework.zend.com/issues/browse/ZF-3581]
* Create the log file only if there is something to log [ZF-5741 | http://framework.zend.com/issues/browse/ZF-5741]
* Add callback support for log events [ZF-7959 | http://framework.zend.com/issues/browse/ZF-7959]
* Filtering messages which are not strings [ZF-5778 | http://framework.zend.com/issues/browse/ZF-5778]
* Methods to remove log writers, filters and event items. [ZF-1833 | http://framework.zend.com/issues/browse/ZF-1833]
<ul>
<li>More flexible mapping ror Zend_Log_Writer_Db <a href="http://framework.zend.com/issues/browse/ZF-2658">ZF-2658 </a></li>
<li>Zend_Log_Formatter_Simple must print %info% event <a href="http://framework.zend.com/issues/browse/ZF-10427">ZF-10427 </a></li>
<li>Incorrect handling of E_DEPRECATED and E_USER_DEPRECATED <a href="http://framework.zend.com/issues/browse/ZF-12031">ZF-12031 </a></li>
<li>Patch to make line and file information available in log events <a href="http://framework.zend.com/issues/browse/ZF-2428">ZF-2428 </a></li>
<li>Add Zend_Log::getWriters() to return list of attached writers <a href="http://framework.zend.com/issues/browse/ZF-3581">ZF-3581 </a></li>
<li>Create the log file only if there is something to log <a href="http://framework.zend.com/issues/browse/ZF-5741">ZF-5741 </a></li>
<li>Add callback support for log events <a href="http://framework.zend.com/issues/browse/ZF-7959">ZF-7959 </a></li>
<li>Filtering messages which are not strings <a href="http://framework.zend.com/issues/browse/ZF-5778">ZF-5778 </a></li>
<li>Methods to remove log writers, filters and event items. <a href="http://framework.zend.com/issues/browse/ZF-1833">ZF-1833 </a></li>
</ul>

h2. Feddbacks/issues of Zend\Log for ZF2

* Array arguments get flattened when creating Zend\Log\Logger [ZF2-34 | http://framework.zend.com/issues/browse/ZF2-34]
* Reflection is used in Zend_Log::__construct() to build priorities name (slow)
* Magic method __call() used for shortcut log an event (slow, and hard to discover API)
* Bad design for Zend_Log::factory() (it calls others factories of writer/formatter/filter defined in config)
<h2>Feddbacks/issues of Zend\Log for ZF2</h2>

<ul>
<li>Array arguments get flattened when creating Zend\Log\Logger <a href="http://framework.zend.com/issues/browse/ZF2-34">ZF2-34 </a></li>
<li>Reflection is used in Zend_Log::__construct() to build priorities name (slow)</li>
<li>Magic method __call() used for shortcut log an event (slow, and hard to discover API)</li>
<li>Bad design for Zend_Log::factory() (it calls others factories of writer/formatter/filter defined in config)</li>
</ul>

h2. Proposals

* API discoverable (emerg, alert, crit, err, warn, notice, info, debug)
* Improve Simple Formatter (according to the feedbacks/issues)
* Use the plugin broker to review factory (Zend\Loader\Broker, Zend\Loader\Pluggable)
* Use of SplPriorityQueue to manage multiple writers (with priorities)
* New formatter (json)
* Add a Zend\Log\Filter\Validator to use a Zend\Validator object like "filter" for the log message
* Create LoggerAware for Di
* Renderer for exceptions, array, string object, event, etc (format exception instead of __toString())
* Modify parameters of Logger::log($priority, $message, $extras)
* Rename Filter\Message in Filter\StringMatch or Filter\Regex

<h2>Proposals</h2>

h2. Usage
<ul>
<li>API discoverable (emerg, alert, crit, err, warn, notice, info, debug)</li>
<li>Improve Simple Formatter (according to the feedbacks/issues)</li>
<li>Use the plugin broker to review factory (Zend\Loader\Broker, Zend\Loader\Pluggable)</li>
<li>Use of SplPriorityQueue to manage multiple writers (with priorities)</li>
<li>New formatter (json)</li>
<li>Add a Zend\Log\Filter\Validator to use a Zend\Validator object like &quot;filter&quot; for the log message</li>
<li>Create LoggerAware for Di</li>
<li>Renderer for exceptions, array, string object, event, etc (format exception instead of __toString())</li>
<li>Modify parameters of Logger::log($priority, $message, $extras)</li>
<li>Rename Filter\Message in Filter\StringMatch or Filter\Regex</li>
</ul>

{code}

<h2>Usage</h2>

<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$logger = new Logger;
// You can attach a filter to exclude records with a priority lower than warning
// You can use a class who implements \__toString() as message and array for extra informations
$logger->error(new RuntimeException('Could not create the order'), $request()->post()->toArray());
{code}
]]></ac:plain-text-body></ac:macro>