generalizing log function