using PEAR_ErrorStack for debug output
| From: | greg at chiaraquartet dot net | Date: | Sat, 12 Jun 2004 23:29:47 +0000 |
| Subject: | using PEAR_ErrorStack for debug output | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-30586@lists.php.net to get a copy of this message | ||
Philippe says:
Agreed, don't we all have our little solution for debug output ;-) What I was
saying is if you are using an image template engine and want to debug, your
debug message may end up in the binary string of the image. Sure you'll get a
broken image, but not convenient for debug, hence the proposed use of the
PEAR::Log as an alternative... I think accepting the log object as
$option['debug'] is the best approach because doesn't actually limit user to
PEAR::Log but to any class as long as it has a "log()" method...
-Philippe
Greg says:
PEAR_ErrorStack is designed specifically for this purpose
$stack->push([debug level], 'debug', array([debug info]), 'debug message');
can be used. The user can set the log object externally, if the stack is a
singleton, and you don't even need to write it into the Template class.
ErrorStack is somewhat misleading. The primary reason it expects a string for
the error level is to allow for some custom stuff such as passing in debug
information. Obviously, you'll only want to do this if the debug level is high
enough to justify displaying, for performance reasons, but that is another
issue.
Greg