Aqui esta lo que necesitas, tomando lo que tenias como referencia:
Código PHP:
<?php
//Leemos la variable enviada en la direccion
$Variable=$_GET['variable'];
//Leemos el nombre del script y le quitamos la extension:
$Nombre=basename($_SERVER['SCRIPT_NAME'], ".php");
$file = fopen('log.txt', 'a', 1);
$text="\n ".date('d')."-".date('m')."-".date('Y')." ".date('G').":".date('H').":".date('s')." ".$Nombre." | ".$Variable."\n\n";
fwrite($file, $text);
fclose($file);
?>
Suerte!