Added support for overriding the log function