Encapsulated error logging