cleanup: Refactor common code in samples. (googleapis/google-cloud-cpp-spanner#403)
cleanup: Refactor common code in samples. (googleapis/google-cloud-cpp-spanner#403)

Also improve logging to troubleshoot build failures.
googleapis/google-cloud-cpp,googleapis/google-cloud-cpp,googleapis/google-cloud-cpp,googleapis/google-cloud-cpp