"Fossies" - the Fresh Open Source Software Archive

Member "z-push/debug.php" (2 Aug 2013, 1404 Bytes) of package /linux/www/old/group-e_z-push_v3.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "debug.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /***********************************************
    3 * File      :   debug.php
    4 * Project   :   Z-Push
    5 * Descr     :   Debuging functions
    6 *
    7 * Created   :   01.10.2007
    8 *
    9 * � Zarafa Deutschland GmbH, www.zarafaserver.de
   10 * This file is distributed under GPL v2.
   11 * Consult LICENSE file for details
   12 ************************************************/
   13 
   14 global $debugstr;
   15 
   16 function debug($str) {
   17     global $debugstr;
   18     $debugstr .= "$str\n";
   19 }
   20 
   21 function getDebugInfo() {
   22     global $debugstr;
   23     
   24     return $debugstr;
   25 }
   26 
   27 function debugLog($message) {
   28     global $devid,$auth_user;
   29 
   30     $fn=BASE_PATH . "debug.txt";
   31     // global log
   32     if (file_exists($fn) && is_writable($fn)) {
   33         $user = (isset($auth_user))?"[". $auth_user ."] ":"";
   34         $date = strftime("%x %X");
   35         $fp = fopen($fn,"a");
   36         fwrite($fp, "$date [". getmypid() ."] ". $user . "$message\n");
   37         fclose($fp);
   38     }
   39     // logging by device
   40     if (isset($devid) && strlen($devid) > 0) {
   41         $fn = STATE_DIR . "/". strtolower($devid). "/debug.txt";
   42         if (file_exists($fn) && is_writable($fn)) {
   43             $fp = fopen($fn,"a");
   44             $date = strftime("%x %X");
   45             fwrite($fp, "$date [". getmypid() ."] $message\n");
   46             fclose($fp);
   47         }
   48     }
   49 }
   50 
   51 
   52 function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {    
   53     debugLog("$errfile:$errline $errstr ($errno)");
   54 }
   55 
   56 error_reporting(E_ALL);
   57 set_error_handler("zarafa_error_handler");
   58 
   59 ?>