예제 #1
0
파일: connect.php 프로젝트: nemiah/poolPi
function log_error($errno, $errmsg, $filename, $linenum)
{
    if (!$GLOBALS["phynxLogPhpErrors"]) {
        return;
    }
    #if(strpos($filename, "PortscanGUI.class.php") !== false AND strpos($errmsg,"fsockopen") !== false) return;
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice');
    if (defined('E_RECOVERABLE_ERROR')) {
        $errortype[E_RECOVERABLE_ERROR] = 'Catchable Fatal Error';
    }
    if (defined('E_DEPRECATED')) {
        $errortype[E_DEPRECATED] = 'Function Deprecated';
    }
    if (!isset($_SESSION["phynx_errors"])) {
        $_SESSION["phynx_errors"] = array();
    }
    if (!PHYNX_USE_SYSLOG) {
        $_SESSION["phynx_errors"][] = array($errortype[$errno], $errmsg, $filename, $linenum);
    } else {
        $type = LOG_INFO;
        switch ($errno) {
            case E_DEPRECATED:
            case E_STRICT:
                $type = LOG_DEBUG;
                break;
            case E_WARNING:
            case E_CORE_WARNING:
            case E_USER_WARNING:
            case E_COMPILE_WARNING:
                $type = LOG_WARNING;
                break;
            case E_PARSE:
            case E_ERROR:
            case E_CORE_ERROR:
            case E_USER_ERROR:
            case E_COMPILE_ERROR:
            case E_RECOVERABLE_ERROR:
                $type = LOG_ERR;
                break;
            case E_NOTICE:
            case E_USER_NOTICE:
                $type = LOG_NOTICE;
                break;
        }
        syslog($type, $errortype[$errno] . ": " . $errmsg . " in {$filename}:{$linenum}");
    }
    #$logfile = realpath(__DIR__."/../")."/log_".date("Y_m_d").".log";
    #@file_put_contents($logfile, date("Y d m H:i:s")." ".$errortype[$errno].": ".$errmsg." in $filename:$linenum\n", FILE_APPEND);
    #chmod($logfile, 0777);
    try {
        SysMessages::log($errortype[$errno] . ": " . $errmsg . "\n{$filename}:{$linenum}", "PHP");
    } catch (Exception $e) {
    }
}
예제 #2
0
function log_error($errno, $errmsg, $filename, $linenum)
{
    if (!$GLOBALS["phynxLogPhpErrors"]) {
        return;
    }
    #if(strpos($filename, "PortscanGUI.class.php") !== false AND strpos($errmsg,"fsockopen") !== false) return;
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice');
    if (defined('E_RECOVERABLE_ERROR')) {
        $errortype[E_RECOVERABLE_ERROR] = 'Catchable Fatal Error';
    }
    if (defined('E_DEPRECATED')) {
        $errortype[E_DEPRECATED] = 'Function Deprecated';
    }
    if (!isset($_SESSION["phynx_errors"])) {
        $_SESSION["phynx_errors"] = array();
    }
    $_SESSION["phynx_errors"][] = array($errortype[$errno], $errmsg, $filename, $linenum);
    try {
        SysMessages::log($errortype[$errno] . ": " . $errmsg . "\n{$filename}:{$linenum}", "PHP");
    } catch (Exception $e) {
    }
}