/**
  * creates the log file if it doesn't exist
  * rename the log file then creates a new one if the existing one has reached the max allowed size (100Ko)
  * open the log file
  * assigns the log file handle to the local var $_handle
  * 
  * @return void
  */
 private static function openHandle()
 {
     $log_filename = KWIXO_ROOT_DIR . '/logs/fianet_log.txt';
     //renames the log file and creates a new one if max allowed size reached
     if (file_exists($log_filename) && filesize($log_filename) > 100000) {
         $prefix = SAC_ROOT_DIR . '/logs/fianetlog-';
         $base = date('YmdHis');
         $sufix = '.txt';
         $filename = $prefix . $base . $sufix;
         for ($i = 0; file_exists($filename); $i++) {
             $filename = $prefix . $base . "-{$i}" . $sufix;
         }
         rename($log_filename, $filename);
     }
     self::$_handle = self::openFile($log_filename);
     register_shutdown_function('fclose', self::$_handle);
 }