add log function.