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.
#include "common/linux/google_crashdump_uploader.h"
#include "third_party/linux/include/glog/logging.h"
#include "third_party/linux/include/gflags/gflags.h"
#include <string>
#include <iostream>
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;

View file

@ -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 <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <iostream>
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);

View file

@ -32,10 +32,12 @@
#include <curl/types.h>
#include <dlfcn.h>
#include <iostream>
#include <string>
#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<type>(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; \
}