Reputation: 117
I just setup FirePHP like this on my getServiceConfig():
use FirePHP as FirePHP;
use Zend\Log\Logger;
use Zend\Log\Writer\FirePhp as FirePhpWriter;
use Zend\Log\Writer\FirePhp\FirePhpBridge;
'logger_firebug' => function($sm) {
$log = new Logger();
$writer = new FirePhpWriter(new FirePhpBridge(new FirePHP()));
$log->addWriter($writer);
return $log;
},
but when I try to use the info function on the controller like this:
$loger = $this->getServiceLocator()->get('logger_firebug');
$loger->info($this);
it gives me an internal error "NetworkError: 500 Internal Server Error" what I want to do is to display a var_dump of the object.
Can some one help me how to show any object structure?
Thanks
Upvotes: 2
Views: 2068
Reputation: 369
Try keeping an instance of $firephp = new FirePHP()
and using $firephp->info($this)
to log messages instead.
Upvotes: 3
Reputation: 16445
This message tells you exactly what is going on.
$message must implement magic
__toString()
method
Checking the link you'll notice, that __toString()
will always, automatically, be called, whenever an Object
is used in the context of a String
. So why does this error message occur? Simple: the $loger->$level()
requires a String
as an argument, but you are trying to give it an Object
How to fix this? Give it a String
$loger->info(\Zend\Debug\Debug::dump($this, $label=null, false));
// Be sure to either set a $label (string) or set it to null
Upvotes: 1