81 function Log_firebug($name =
'', $ident =
'PHP', $conf = array(),
84 $this->_id = md5(microtime());
85 $this->_ident = $ident;
87 if (isset($conf[
'buffering'])) {
88 $this->_buffering = $conf[
'buffering'];
91 if ($this->_buffering) {
92 register_shutdown_function(array(&$this,
'_Log_firebug'));
95 if (!empty($conf[
'lineFormat'])) {
96 $this->_lineFormat = str_replace(array_keys($this->_formatMap),
97 array_values($this->_formatMap),
101 if (!empty($conf[
'timeFormat'])) {
102 $this->_timeFormat = $conf[
'timeFormat'];
113 $this->_opened =
true;
133 $this->_opened =
false;
143 if (count($this->_buffer)) {
144 print
'<script type="text/javascript">';
145 print
"\nif (('console' in window) && ('firebug' in console)) {\n";
146 foreach ($this->_buffer as $line) {
152 $this->_buffer = array();
167 function log($message, $priority = null)
170 if ($priority === null) {
181 $method = $this->_methods[$priority];
184 $message = str_replace(
"\r\n",
"\n", $message);
187 $message = str_replace(
"\n",
"\\n\\\n", $message);
190 $message = str_replace(
'"',
'\\"', $message);
193 $line = $this->
_format($this->_lineFormat,
194 strftime($this->_timeFormat),
198 if ($this->_buffering) {
199 $this->_buffer[] = sprintf(
'console.%s("%s");', $method, $line);
201 print
'<script type="text/javascript">';
202 print
"\nif (('console' in window) && ('firebug' in console)) {\n";
204 printf(
' console.%s("%s");', $method, $line);
209 $this->
_announce(array(
'priority' => $priority,
'message' => $message));
_announce($event)
Informs each registered observer instance that a new message has been logged.
UPTO($priority)
Calculate the log mask for all priorities up to the given priority.
_Log_firebug()
Destructor.
flush()
Flushes all pending ("buffered") data.
close()
Closes the firebug handler.
log($message, $priority=null)
Writes $message to Firebug console.
_isMasked($priority)
Check if the given priority is included in the current level mask.
_extractMessage($message)
Returns the string representation of the message data.
_format($format, $timestamp, $priority, $message)
Produces a formatted log line based on a format string and a set of variables representing the curren...
Log_firebug($name='', $ident='PHP', $conf=array(), $level=PEAR_LOG_DEBUG)
Constructs a new Log_firebug object.
open()
Opens the firebug handler.