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));