Add logging mechanism

* Replace 'print' statements with the appropriate log calls
* Replace sys.stderr calls with the appropriate log calls
* Remove global variable HUPTIME_DEBUG