additional logging added to socket.
log disables debig by default, now can have a file passed in for printing logging to instead of stdout.