refactoring logging module