move logging inside __main__ section