python method for creating logfiles