'; } if ($logno <= LOG_LEVEL_WRITE) { $filename = 'logfile.txt'; if (is_writable($filename)) { //Check if the file can be opened if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $errorString to file. if (fwrite($handle, $errorString) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($handle); } else { echo "The file $filename is not writable"; } } if ($logno <= LOG_LEVEL_MAIL) { mail('test@test.com', 'Nodemap error', $errorString); } } } $LOG_HANDLER = new LogHandler(); /* * Function: trigger_log * Parameters: int $logno, string $logstr, string $logfile, int $logline * Function: Handling with log entries, forwarding them to our $LOG_HANDLER object. */ function trigger_log($logno, $logstr, $logfile, $logline) { global $LOG_HANDLER; $LOG_HANDLER->logEntry($logno, $logstr, $logfile, $logline); } ?>