Document logging with custom level, some cleanup