From 8e3c63b7f940016c1683df5f6b87dcaf952fa027 Mon Sep 17 00:00:00 2001 From: nealsid Date: Thu, 27 May 2010 19:37:24 +0000 Subject: [PATCH] Remove LOG statements from linux utilities so there's no dependency on log library A=Zhurun R=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@604 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../sender/google_crash_report_sender.cc | 6 ++-- src/common/linux/google_crashdump_uploader.cc | 29 ++++++++++--------- src/common/linux/libcurl_wrapper.cc | 24 ++++++++------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/client/linux/sender/google_crash_report_sender.cc b/src/client/linux/sender/google_crash_report_sender.cc index da9661da..c1641b4f 100644 --- a/src/client/linux/sender/google_crash_report_sender.cc +++ b/src/client/linux/sender/google_crash_report_sender.cc @@ -28,9 +28,11 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "common/linux/google_crashdump_uploader.h" -#include "third_party/linux/include/glog/logging.h" #include "third_party/linux/include/gflags/gflags.h" #include +#include + +using std::string; DEFINE_string(crash_server, "http://clients2.google.com/cr", "The crash server to upload minidumps to."); @@ -75,7 +77,7 @@ bool CheckForRequiredFlagsOrDie() { } if (!error_text.empty()) { - LOG(ERROR) << error_text; + std::cout << error_text; return false; } return true; diff --git a/src/common/linux/google_crashdump_uploader.cc b/src/common/linux/google_crashdump_uploader.cc index f47a8e5e..b739a6f6 100644 --- a/src/common/linux/google_crashdump_uploader.cc +++ b/src/common/linux/google_crashdump_uploader.cc @@ -30,12 +30,15 @@ #include "common/linux/google_crashdump_uploader.h" #include "common/linux/libcurl_wrapper.h" -#include "third_party/linux/include/glog/logging.h" #include #include #include +#include + +using std::string; + namespace google_breakpad { GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product, @@ -115,21 +118,21 @@ void GoogleCrashdumpUploader::Init(const std::string& product, proxy_host_ = proxy_host; proxy_userpassword_ = proxy_userpassword; minidump_pathname_ = minidump_pathname; - LOG(INFO) << "Uploader initializing"; - LOG(INFO) << "\tProduct: " << product_; - LOG(INFO) << "\tVersion: " << version_; - LOG(INFO) << "\tGUID: " << guid_; + std::cout << "Uploader initializing"; + std::cout << "\tProduct: " << product_; + std::cout << "\tVersion: " << version_; + std::cout << "\tGUID: " << guid_; if (!ptime_.empty()) { - LOG(INFO) << "\tProcess uptime: " << ptime_; + std::cout << "\tProcess uptime: " << ptime_; } if (!ctime_.empty()) { - LOG(INFO) << "\tCumulative Process uptime: " << ctime_; + std::cout << "\tCumulative Process uptime: " << ctime_; } if (!email_.empty()) { - LOG(INFO) << "\tEmail: " << email_; + std::cout << "\tEmail: " << email_; } if (!comments_.empty()) { - LOG(INFO) << "\tComments: " << comments_; + std::cout << "\tComments: " << comments_; } } @@ -152,7 +155,7 @@ bool GoogleCrashdumpUploader::CheckRequiredParametersArePresent() { } if (!error_text.empty()) { - LOG(ERROR) << error_text; + std::cout << error_text; return false; } return true; @@ -162,7 +165,7 @@ bool GoogleCrashdumpUploader::CheckRequiredParametersArePresent() { bool GoogleCrashdumpUploader::Upload() { bool ok = http_layer_->Init(); if (!ok) { - LOG(WARNING) << "http layer init failed"; + std::cout << "http layer init failed"; return ok; } @@ -173,7 +176,7 @@ bool GoogleCrashdumpUploader::Upload() { struct stat st; int err = stat(minidump_pathname_.c_str(), &st); if (err) { - LOG(WARNING) << minidump_pathname_ << " could not be found: " << errno; + std::cout << minidump_pathname_ << " could not be found"; return false; } @@ -188,7 +191,7 @@ bool GoogleCrashdumpUploader::Upload() { "upload_file_minidump")) { return false; } - LOG(INFO) << "Sending request to " << crash_server_; + std::cout << "Sending request to " << crash_server_; return http_layer_->SendRequest(crash_server_, parameters_, NULL); diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc index 78b96163..e21a43db 100644 --- a/src/common/linux/libcurl_wrapper.cc +++ b/src/common/linux/libcurl_wrapper.cc @@ -32,10 +32,12 @@ #include #include +#include #include #include "common/linux/libcurl_wrapper.h" -#include "third_party/linux/include/glog/logging.h" + +using std::string; namespace google_breakpad { LibcurlWrapper::LibcurlWrapper() @@ -51,10 +53,10 @@ LibcurlWrapper::LibcurlWrapper() curl_lib_ = dlopen("libcurl.so.3", RTLD_NOW); } if (!curl_lib_) { - LOG(WARNING) << "Could not find libcurl via dlopen"; + std::cout << "Could not find libcurl via dlopen"; return; } - LOG(INFO) << "LibcurlWrapper init succeeded"; + std::cout << "LibcurlWrapper init succeeded"; init_ok_ = true; return; } @@ -68,16 +70,16 @@ bool LibcurlWrapper::SetProxy(const std::string& proxy_host, if (!proxy_host.empty()) { (*easy_setopt_)(curl_, CURLOPT_PROXY, proxy_host.c_str()); } else { - LOG(WARNING) << "SetProxy called with empty proxy host."; + std::cout << "SetProxy called with empty proxy host."; return false; } if (!proxy_userpwd.empty()) { (*easy_setopt_)(curl_, CURLOPT_PROXYUSERPWD, proxy_userpwd.c_str()); } else { - LOG(WARNING) << "SetProxy called with empty proxy username/password."; + std::cout << "SetProxy called with empty proxy username/password."; return false; } - LOG(INFO) << "Set proxy host to " << proxy_host; + std::cout << "Set proxy host to " << proxy_host; return true; } @@ -86,7 +88,7 @@ bool LibcurlWrapper::AddFile(const std::string& upload_file_path, if (!init_ok_) { return false; } - LOG(INFO) << "Adding " << upload_file_path << " to form upload."; + std::cout << "Adding " << upload_file_path << " to form upload."; // Add form file. (*formadd_)(&formpost_, &lastptr_, CURLFORM_COPYNAME, basename.c_str(), @@ -151,12 +153,12 @@ bool LibcurlWrapper::SendRequest(const std::string& url, bool LibcurlWrapper::Init() { if (!init_ok_) { - LOG(WARNING) << "Init_OK was not true in LibcurlWrapper::Init(), check earlier log messages"; + std::cout << "Init_OK was not true in LibcurlWrapper::Init(), check earlier log messages"; return false; } if (!SetFunctionPointers()) { - LOG(WARNING) << "Could not find function pointers"; + std::cout << "Could not find function pointers"; init_ok_ = false; return false; } @@ -167,7 +169,7 @@ bool LibcurlWrapper::Init() { if (!curl_) { dlclose(curl_lib_); - LOG(WARNING) << "Curl initialization failed"; + std::cout << "Curl initialization failed"; return false; } @@ -182,7 +184,7 @@ bool LibcurlWrapper::Init() { #define SET_AND_CHECK_FUNCTION_POINTER(var, function_name, type) \ var = reinterpret_cast(dlsym(curl_lib_, function_name)); \ if (!var) { \ - LOG(WARNING) << "Could not find libcurl function " << function_name; \ + std::cout << "Could not find libcurl function " << function_name; \ init_ok_ = false; \ return false; \ }