factor out logger and change logging format