static function log($msg,$path = "") {
    if(empty($path)){
      $path = MF_FILES_DIR;
    }

    if(!is_string($msg)){
      $msg = print_r($msg,true);
    }

    $fp = fopen($path.'magic_fields.log', 'a+');
    $date = gmdate( 'Y-m-d H:i:s' );
    fwrite($fp, "$date - $msg\n");
    fclose($fp);
   }