Beispiel #1
0
 public static function trace($s)
 {
     // DISABLE FOR NON-LOCAL ENVIRONMENTS
     if ($_SERVER['SERVER_NAME'] == 'localhost') {
         ///NEED TO UPDATE PERMISSIONS TO BE ABLE TO WRITE FILES :(
         // open file
         if (self::$LOG_PATH == '') {
             self::$LOG_PATH = self::$DEFAULT_PATH;
         }
         $filePath = $_SERVER['DOCUMENT_ROOT'] . '/utils/loggers/' . self::$LOG_PATH;
         $contents = file_get_contents($filePath);
         $mode = strlen($contents) > self::LOG_LIMIT ? 'w' : 'a';
         $fd = fopen($filePath, $mode) or die('could not open or create phplog file!');
         // write string
         fwrite($fd, $s . "\r\n");
         //            fwrite($fd, 'count: '.strlen($contents) . "\r\n");
         // close file
         fclose($fd);
     }
 }