logdb code refactoring