Zebra_Database::_log PHP Method

_log() private method

@access private
private _log ( $category, $data, $fatal = true )
    private function _log($category, $data, $fatal = true)
    {
        // if debugging is on
        if ($this->debug) {
            // if category is different than "warnings"
            // (warnings are generated internally)
            if ($category != 'warnings') {
                // get backtrace information
                $backtrace_data = debug_backtrace();
                // unset first entry as it refers to the call to this particular method
                unset($backtrace_data[0]);
                $data['backtrace'] = array();
                // iterate through the backtrace information
                foreach ($backtrace_data as $backtrace) {
                    // extract needed information
                    $data['backtrace'][] = array($this->language['file'] => isset($backtrace['file']) ? $backtrace['file'] : '', $this->language['function'] => $backtrace['function'] . '()', $this->language['line'] => isset($backtrace['line']) ? $backtrace['line'] : '');
                }
            }
            // saves debug information
            $this->debug_info[$category][] = $data;
            // if the saved debug info is about a fatal error
            // and execution is to be stopped on fatal errors
            if ($fatal && $this->halt_on_errors) {
                // show the debugging window
                $this->show_debug_console();
                // halt execution
                die;
            }
            // if there are any unsuccessful queries or other errors and no debugging
        } elseif (($category == 'unsuccessful-queries' || $category == 'errors') && !$this->debug) {
            // get backtrace information
            $backtraceInfo = debug_backtrace();
            // log error to the system logger
            error_log('Zebra_Database (MySQL): ' . (isset($data['error']) ? $data['error'] : $data['message']) . print_r(' in ' . $backtraceInfo[1]['file'] . ' on line ' . $backtraceInfo[1]['line'], true));
        }
    }