logtrace: cleanup code and fix compiling warnings