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

Can you provide a patch? I am not familiar with the setFormatter() and setEventItem() methods.

I guess.

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);

Minor comment issue (copied from simple.php for the formatter). This should be better.

Reassigning to get patch applied

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.

Kevin: if you do create some tests, reassign to me, and I'll apply the patch.

Kevin: Thanks for your contribution. I really appreciate the help.

Closing marking incomplete. Patch is provided, but needs tests.

FYI: I will be working on a test for this patch soon.

Applied patch + fixes + unit tests.