refactor logtrace