Fine-tuned error logging