Simplified error logging function