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
This commit is contained in:
nealsid 2010-05-27 19:37:24 +00:00
parent b0059c54da
commit 8e3c63b7f9
3 changed files with 33 additions and 26 deletions

View file

@ -28,9 +28,11 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/linux/google_crashdump_uploader.h" #include "common/linux/google_crashdump_uploader.h"
#include "third_party/linux/include/glog/logging.h"
#include "third_party/linux/include/gflags/gflags.h" #include "third_party/linux/include/gflags/gflags.h"
#include <string> #include <string>
#include <iostream>
using std::string;
DEFINE_string(crash_server, "http://clients2.google.com/cr", DEFINE_string(crash_server, "http://clients2.google.com/cr",
"The crash server to upload minidumps to."); "The crash server to upload minidumps to.");
@ -75,7 +77,7 @@ bool CheckForRequiredFlagsOrDie() {
} }
if (!error_text.empty()) { if (!error_text.empty()) {
LOG(ERROR) << error_text; std::cout << error_text;
return false; return false;
} }
return true; return true;

View file

@ -30,12 +30,15 @@
#include "common/linux/google_crashdump_uploader.h" #include "common/linux/google_crashdump_uploader.h"
#include "common/linux/libcurl_wrapper.h" #include "common/linux/libcurl_wrapper.h"
#include "third_party/linux/include/glog/logging.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <iostream>
using std::string;
namespace google_breakpad { namespace google_breakpad {
GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product, GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product,
@ -115,21 +118,21 @@ void GoogleCrashdumpUploader::Init(const std::string& product,
proxy_host_ = proxy_host; proxy_host_ = proxy_host;
proxy_userpassword_ = proxy_userpassword; proxy_userpassword_ = proxy_userpassword;
minidump_pathname_ = minidump_pathname; minidump_pathname_ = minidump_pathname;
LOG(INFO) << "Uploader initializing"; std::cout << "Uploader initializing";
LOG(INFO) << "\tProduct: " << product_; std::cout << "\tProduct: " << product_;
LOG(INFO) << "\tVersion: " << version_; std::cout << "\tVersion: " << version_;
LOG(INFO) << "\tGUID: " << guid_; std::cout << "\tGUID: " << guid_;
if (!ptime_.empty()) { if (!ptime_.empty()) {
LOG(INFO) << "\tProcess uptime: " << ptime_; std::cout << "\tProcess uptime: " << ptime_;
} }
if (!ctime_.empty()) { if (!ctime_.empty()) {
LOG(INFO) << "\tCumulative Process uptime: " << ctime_; std::cout << "\tCumulative Process uptime: " << ctime_;
} }
if (!email_.empty()) { if (!email_.empty()) {
LOG(INFO) << "\tEmail: " << email_; std::cout << "\tEmail: " << email_;
} }
if (!comments_.empty()) { if (!comments_.empty()) {
LOG(INFO) << "\tComments: " << comments_; std::cout << "\tComments: " << comments_;
} }
} }
@ -152,7 +155,7 @@ bool GoogleCrashdumpUploader::CheckRequiredParametersArePresent() {
} }
if (!error_text.empty()) { if (!error_text.empty()) {
LOG(ERROR) << error_text; std::cout << error_text;
return false; return false;
} }
return true; return true;
@ -162,7 +165,7 @@ bool GoogleCrashdumpUploader::CheckRequiredParametersArePresent() {
bool GoogleCrashdumpUploader::Upload() { bool GoogleCrashdumpUploader::Upload() {
bool ok = http_layer_->Init(); bool ok = http_layer_->Init();
if (!ok) { if (!ok) {
LOG(WARNING) << "http layer init failed"; std::cout << "http layer init failed";
return ok; return ok;
} }
@ -173,7 +176,7 @@ bool GoogleCrashdumpUploader::Upload() {
struct stat st; struct stat st;
int err = stat(minidump_pathname_.c_str(), &st); int err = stat(minidump_pathname_.c_str(), &st);
if (err) { if (err) {
LOG(WARNING) << minidump_pathname_ << " could not be found: " << errno; std::cout << minidump_pathname_ << " could not be found";
return false; return false;
} }
@ -188,7 +191,7 @@ bool GoogleCrashdumpUploader::Upload() {
"upload_file_minidump")) { "upload_file_minidump")) {
return false; return false;
} }
LOG(INFO) << "Sending request to " << crash_server_; std::cout << "Sending request to " << crash_server_;
return http_layer_->SendRequest(crash_server_, return http_layer_->SendRequest(crash_server_,
parameters_, parameters_,
NULL); NULL);

View file

@ -32,10 +32,12 @@
#include <curl/types.h> #include <curl/types.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <iostream>
#include <string> #include <string>
#include "common/linux/libcurl_wrapper.h" #include "common/linux/libcurl_wrapper.h"
#include "third_party/linux/include/glog/logging.h"
using std::string;
namespace google_breakpad { namespace google_breakpad {
LibcurlWrapper::LibcurlWrapper() LibcurlWrapper::LibcurlWrapper()
@ -51,10 +53,10 @@ LibcurlWrapper::LibcurlWrapper()
curl_lib_ = dlopen("libcurl.so.3", RTLD_NOW); curl_lib_ = dlopen("libcurl.so.3", RTLD_NOW);
} }
if (!curl_lib_) { if (!curl_lib_) {
LOG(WARNING) << "Could not find libcurl via dlopen"; std::cout << "Could not find libcurl via dlopen";
return; return;
} }
LOG(INFO) << "LibcurlWrapper init succeeded"; std::cout << "LibcurlWrapper init succeeded";
init_ok_ = true; init_ok_ = true;
return; return;
} }
@ -68,16 +70,16 @@ bool LibcurlWrapper::SetProxy(const std::string& proxy_host,
if (!proxy_host.empty()) { if (!proxy_host.empty()) {
(*easy_setopt_)(curl_, CURLOPT_PROXY, proxy_host.c_str()); (*easy_setopt_)(curl_, CURLOPT_PROXY, proxy_host.c_str());
} else { } else {
LOG(WARNING) << "SetProxy called with empty proxy host."; std::cout << "SetProxy called with empty proxy host.";
return false; return false;
} }
if (!proxy_userpwd.empty()) { if (!proxy_userpwd.empty()) {
(*easy_setopt_)(curl_, CURLOPT_PROXYUSERPWD, proxy_userpwd.c_str()); (*easy_setopt_)(curl_, CURLOPT_PROXYUSERPWD, proxy_userpwd.c_str());
} else { } else {
LOG(WARNING) << "SetProxy called with empty proxy username/password."; std::cout << "SetProxy called with empty proxy username/password.";
return false; return false;
} }
LOG(INFO) << "Set proxy host to " << proxy_host; std::cout << "Set proxy host to " << proxy_host;
return true; return true;
} }
@ -86,7 +88,7 @@ bool LibcurlWrapper::AddFile(const std::string& upload_file_path,
if (!init_ok_) { if (!init_ok_) {
return false; return false;
} }
LOG(INFO) << "Adding " << upload_file_path << " to form upload."; std::cout << "Adding " << upload_file_path << " to form upload.";
// Add form file. // Add form file.
(*formadd_)(&formpost_, &lastptr_, (*formadd_)(&formpost_, &lastptr_,
CURLFORM_COPYNAME, basename.c_str(), CURLFORM_COPYNAME, basename.c_str(),
@ -151,12 +153,12 @@ bool LibcurlWrapper::SendRequest(const std::string& url,
bool LibcurlWrapper::Init() { bool LibcurlWrapper::Init() {
if (!init_ok_) { 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; return false;
} }
if (!SetFunctionPointers()) { if (!SetFunctionPointers()) {
LOG(WARNING) << "Could not find function pointers"; std::cout << "Could not find function pointers";
init_ok_ = false; init_ok_ = false;
return false; return false;
} }
@ -167,7 +169,7 @@ bool LibcurlWrapper::Init() {
if (!curl_) { if (!curl_) {
dlclose(curl_lib_); dlclose(curl_lib_);
LOG(WARNING) << "Curl initialization failed"; std::cout << "Curl initialization failed";
return false; return false;
} }
@ -182,7 +184,7 @@ bool LibcurlWrapper::Init() {
#define SET_AND_CHECK_FUNCTION_POINTER(var, function_name, type) \ #define SET_AND_CHECK_FUNCTION_POINTER(var, function_name, type) \
var = reinterpret_cast<type>(dlsym(curl_lib_, function_name)); \ var = reinterpret_cast<type>(dlsym(curl_lib_, function_name)); \
if (!var) { \ if (!var) { \
LOG(WARNING) << "Could not find libcurl function " << function_name; \ std::cout << "Could not find libcurl function " << function_name; \
init_ok_ = false; \ init_ok_ = false; \
return false; \ return false; \
} }