added sorts of logging support for kmeans (since its external library originally dumps to the likes of stdout)