Use getLogger method instead of a global log object Also use caplog fixture to capture log messages in unit tests. This Fixes #1244
This commit relocates unit tests to a folder structure that matches the source code structure. Fixes #1128