[x] Created exceptions.py module, with custom exceptions, exception hooks and external warnings (not raised by amami custom formatting).
[x] Custom exceptions have custom hooks, for the message to be handled by the custom logger via LOGGER.error; in debug mode the traceback is printed. Any exception that is not custom (built-in or thrid-party module) is raised as a normal exception with traceback. Those should not be present in production, and if present it means there is a bug that needs to be fixed.
[x] No need for a try/except wrapper anymore because of the custom exception hooks. The important thing now is to always raise a custom exception. If for any reason we want to raise a built-in exception we need to create a similar custom one and raise the custom one instead (for example as done with the AmamiNotImplementedError).
[x] Custom logging module now sends message to the appropriate stream: stdout for INFO and DEBUG messages, stderr for WARNING and ERROR ones.
[x] Removed custom logging methods for different logging levels and replaced that logic by modifying the _logRecordFactory class to indent the message before it gets passed to the logging-level method (debug, info, etc.).
[x] amami/loggers.py module is shorter and simpler.
Fixes #40 and #18
General modifications:
exceptions.py
module, with custom exceptions, exception hooks and external warnings (not raised byamami
custom formatting).LOGGER.error
; in debug mode the traceback is printed. Any exception that is not custom (built-in or thrid-party module) is raised as a normal exception with traceback. Those should not be present in production, and if present it means there is a bug that needs to be fixed.AmamiNotImplementedError
).stdout
for INFO and DEBUG messages,stderr
for WARNING and ERROR ones._logRecordFactory
class to indent the message before it gets passed to the logging-level method (debug, info, etc.).amami/loggers.py
module is shorter and simpler.