Minor refactoring of logging functions.