log refactoring with inline backtrace