ZF-4952: Zend_Log_Writer_Firebug does not conform to formatters or setEventItem
Description
The Zend_Log_Writer_Firebug class does not implement setFormatter() and as a result cannot be formatted. It also ignores extra information provided in setEventItem.
Suggested fix is to implement setFormatter() correctly, and pass the formatted string to Zend_Wildfire_Plugin_FirePhp::getInstance()->send($event['message'], null, $type) within the _write method.
It would also be nice if instead of simply null'ing the Label parameter, that it be interfaced with setEventItem() such that a label could be provided.
Comments
Posted by Christoph Dorn (cadorn) on 2008-11-17T20:40:28.000+0000
Can you provide a patch? I am not familiar with the setFormatter() and setEventItem() methods.
Posted by Kevin McArthur (kevin) on 2008-11-17T21:53:13.000+0000
I guess.
Posted by Kevin McArthur (kevin) on 2008-11-17T23:57:11.000+0000
This patch resolves this issue. Please apply it and close, or give my account "kevin" write access on this component.
This patch is backwards compatible and does not alter the public api other than to activate the setFormatter method which previously threw an exception. It implements the stock formatter, but is easily overridden to produce more complicated output.
It adds support for a new event item 'firebugLabel' which will be passed along instead of a hard coded null to the wildfire api if present.
Exercising code:
$logger = new Zend_Log();
$fireWriter = new Zend_Log_Writer_Firebug(); $logger->addWriter($fireWriter);
$logger->setEventItem('firebugLabel','Test Label'); $logger->log(array('a','b','c'), Zend_Log::DEBUG);
Posted by Kevin McArthur (kevin) on 2008-11-18T00:07:10.000+0000
Minor comment issue (copied from simple.php for the formatter). This should be better.
Posted by Kevin McArthur (kevin) on 2008-11-19T10:05:28.000+0000
Reassigning to get patch applied
Posted by Matthew Weier O'Phinney (matthew) on 2008-11-20T13:44:48.000+0000
Kevin --- can you include some tests for this? That would make it easier for me to justify applying the patch -- right now, it introduces new, untested behavior, and I'd need to determine how to trigger it in the test suite.
Posted by Matthew Weier O'Phinney (matthew) on 2008-11-20T13:45:17.000+0000
Kevin: if you do create some tests, reassign to me, and I'll apply the patch.
Posted by Christoph Dorn (cadorn) on 2008-11-20T17:18:37.000+0000
Kevin: Thanks for your contribution. I really appreciate the help.
Posted by Kevin McArthur (kevin) on 2008-12-04T13:52:08.000+0000
Closing marking incomplete. Patch is provided, but needs tests.
Posted by Christoph Dorn (cadorn) on 2008-12-08T12:17:40.000+0000
FYI: I will be working on a test for this patch soon.
Posted by Christoph Dorn (cadorn) on 2009-01-13T17:55:52.000+0000
Applied patch + fixes + unit tests.