added  write_log function

The write_log() function dries out the logging functionality in get_socrata_data() function
Line 56 belongs between lines 63 and 64. Can you fix that and issue another pull request?

Overall the way that returns are handled in this function has always been bad, but for now we should at least keep it functioning :)