add logging

To use, use NDEBUG pp guards with cerr.
Split into a compiled exec and a bash script that does error redirecting.
Log file stays locally for two reasons:
1) for long-term debugging
2) easier than conditionally deleting it.