Add tests, refactor
Refactor logging

There's an annoying circular dependency between setup_log and config now.
That's why all the config methods take a logger rather than importing it.