added support for overriding the log function