Improved logging functionality with log.writeError - which gives extra
emphasis to errors in the log.