Catch the moment when theme is deleted

There are two direct actions that you can hook into while deleting a theme

do_action( 'delete_theme', $stylesheet );

And

do_action( 'deleted_theme', $stylesheet, $deleted );

Now about the error_log() function, you seem to be missing a argument, the destination.
One of my debugging tool is a custom error_log function, this is its code.

error_log(print_r($some_value, true), 3, __DIR__ . '/log.txt');
error_log("\r\n\r\n", 3,  __DIR__ . '/log.txt');

This will create a log.txt file in the same folder where you called this functions. If you use this in functions.php the log.txt will be in the root of your theme.