Redirecting warnings to stderr, close #826

This required a new "logger" class to avoid circular dependencies.
I also edited inconsistencies in logged messages (mostly newlines)