more refactoring of logging feature