Re: enhance version of PEAR::Log display driver
| From: | Laurent Laville | Date: | Sun, 18 Jul 2004 18:31:52 +0000 |
| Subject: | Re: enhance version of PEAR::Log display driver | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32123@lists.php.net to get a copy of this message | ||
BTW, if you want a such solution running in all cases (i mean composite)
i suggest also to path the Log.php file, _extractMessage method as below :
What do you think about it Jon ?
function _extractMessage($message)
{
...
} else if (is_array($message)) {
if (array_key_exists('message', $message)) {
$message = $message['message'];
} else {
$message = print_r($message, true);
}
//$message = print_r($message, true); // rather than just
this line
...
}
And if you pass an array like PEAR_ErrorStack, it will work better for all
other drivers
especially when you use 'composite' driver as me in HTML_Progress.
Just my few and last comments
Laurent Laville
-----------------------
PHP For Ever http://pear.php.net/user/farell
Few month ago when i've begun to implement PEAR_ErrorStack into
HTML_Progress
i was a bit disapointed by PEAR::Log display driver (current version
available on package 1.8.4).
So i've contacted Paul Yanchenko (author of LOG display driver) and wrote a
first enhance version.
Finally i'm also sad of features of my own proposal, even if it's allow me
to write this new version
i'll present you now !
You can see source code and live demos at
http://pear.laurent-laville.org/HTML_Progress/examples/errorstack/display_er
rors2.html
Example A.1 show how you can use the new version like the current one (Paul
Yanchenko's version)
There are 5 examples A1 A2 A3, B1 B2
Take CARE that these examples works only because i've patched a little
PEAR_ErrorStack. (Greg it's for you) !
Effectively, to keep current structure of PEAR::LOG architecture, we can't
give a third argument on
log method as it was done by
PEAR_ErrorStack::_log() method
Here are my patch
if ($this->_logger) {
//$this->_logger->log($err['message'], $level, $err);
$this->_logger->log($err, $level);
} else {
//$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']->log($err['message'], $level,
$err);
$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']->log($err, $level);
}
(and of course use it with my new display driver version )
http://pear.laurent-laville.org/HTML_Progress/examples/highlighter.php?file=
./errorstack/display185.php
Feel free to tell me what you think about it
I'll be away until tomorrow in evening, so excuse me if i can't reply to
your mails before .
Laurent