Add context manager for logging and dismissing exceptions