Some optimizations for logging functions.