/** * Adds a log entry to the log %router. * * @param string $detail * The full details of the log entry or a variable. * @param string $title * (optional) A short name describing the subject or title of the log * entry. * @param integer $logLevel * (optional) The importance level of the log entry. * @return NULL */ protected function _log($detail, $title = '', $logLevel = self::LOG_LEVEL_DEBUG) { global $phpAnvil; if (isset($phpAnvil) && is_object($phpAnvil) && $logLevel <= $this->logLevel && $this->isLogEnabled()) { $backTrace = debug_backtrace(); //---- Add to anvilFuseTrace ------------------------------------------ if ($this->_isTraceDefined()) { if (!empty($title)) { $traceInfo = $title . ' = ' . $detail; } else { $traceInfo = $detail; } anvilFuseTrace::add($backTrace[1]['file'], $backTrace[2]['class'] . '::' . $backTrace[2]['function'], $backTrace[1]['line'], $traceInfo, $logLevel); } // $extendedTitle = '[' . $backTrace[2]['class'] . '->' . $backTrace[2]['function'] . ': Line ' . $backTrace[1]['line'] . '] ' . $title; $extendedTitle = $backTrace[2]['class'] . '->' . $backTrace[2]['function'] . ' (' . $backTrace[1]['line'] . ') ' . $title; //---- Output to FirePHP/FireBug ----------------------------------- switch ($logLevel) { case self::LOG_LEVEL_DEBUG: fb::log($detail, $extendedTitle); break; case self::LOG_LEVEL_BRIEF_INFO: case self::LOG_LEVEL_VERBOSE_INFO: fb::info($detail, $title); break; case self::LOG_LEVEL_WARNING: fb::warn($detail, $extendedTitle); break; case self::LOG_LEVEL_ERROR: case self::LOG_LEVEL_CRITICAL: // for ($i=0; $i < 3; $i++) { // fb::log($backTrace[$i]['file'], '$backTrace[' . $i . '][file]'); // fb::log($backTrace[$i]['class'], '$backTrace[' . $i . '][class]'); // fb::log($backTrace[$i]['function'], '$backTrace[' . $i . '][function]'); // fb::log($backTrace[$i]['line'], '$backTrace[' . $i . '][line]'); // } fb::error($detail, $title); $errorLocation = $backTrace[1]['file']; $errorLocation .= ': ' . $backTrace[2]['class']; $errorLocation .= '->' . $backTrace[2]['function']; $errorLocation .= ': Line ' . $backTrace[1]['line']; fb::error($errorLocation); break; } } }