This example logs the date and time a record was deleted and who deleted it.

function tablename_after_delete($selectedID, $memberInfo, &$args){
    // log file
    $logFile='deletes.log';
     
    // attempt to open the log file for appending
    if(!$fp = @fopen($logFile, 'a')) return;
     
    // write log data: date/time, username, IP, record ID
    $datetime=date('r');
    fwrite($fp, "$datetime,{$memberInfo['username']},{$memberInfo['IP']},$selectedID\n");
    fclose($fp);
}