Rework logging functions to make overriding work reasonably.