General cleanup work continue

- Made all the dbg log_* macros into single-statement
- Replaced all perror() calls with the new log_* macros