Use logger module to allow logging to syslog when in daemon mode, or stdout otherwise.
Replace all prints with calls to logger module