User-Defined Exceptions and Logging in Python