Posts tagged ‘pear’

Log 包(用户文档)提供了多种 event handler 用以记录日志信息(开发过程中的调试信息)。

其中一个适用于开发过程的 window handler,在实际使用中 log window 不能显示日志信息。解决方法,打开 PEAR/Log.php, 在方法 _writeln() 里找到下列三行,将它们注释掉:

/* Buffer the output until this page's headers have been sent. */
if (!headers_sent()) {
  return;
}

使用方法如下:

require_once("Log.php");

$conf = array('title' => 'Sample Log Output');
$logger = &Log::singleton('win', 'LogWindow', 'ident', $conf);
for ($i = 0; $i < 10; $i++) {
    $logger->log("Log entry $i");
}