Changed indentation and added logger.

According to PEP8, "Use 4 spaces per indentation level".

Added logger so that output messages are printed to file rather than to
the console (to prepare running this as a background server).