Esempio n. 1
0
function logline($ll, $msg)
{
    global $LOGLEVEL, $LOG, $MAXLOGSIZE, $LOGFILE;
    if ($LOGLEVEL and $ll <= $LOGLEVEL) {
        $LOG = fopen($LOGFILE, "a");
        if ($LOG) {
            fwrite($LOG, date("d.m.Y H:i:s") . " - {$msg}\r\n");
            $lstat = fstat($LOG);
            if ($lstat["size"] > $MAXLOGSIZE) {
                rotatelog();
            }
            fclose($LOG);
        }
    }
}
Esempio n. 2
0
function log_line_to_file($debug, $msg)
{
    global $LOG, $LOG_DEBUG, $MAXLOGSIZE, $LOGFILE, $LOGFILEHANDLE;
    if ($LOG && (!$debug || $LOG_DEBUG)) {
        $LOGFILEHANDLE = fopen($LOGFILE, "a");
        if ($LOGFILEHANDLE) {
            fwrite($LOGFILEHANDLE, date("d.m.Y H:i:s") . " - {$msg}\r\n");
            $lstat = fstat($LOGFILEHANDLE);
            if ($lstat["size"] > $MAXLOGSIZE) {
                rotatelog();
            }
            fclose($LOGFILEHANDLE);
        }
    }
}