Generic refactoring regarding logging functionality.