Log module cleanup

This is a fixed version of the PR #20 against the develop branch instead of the master one.