Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1489)

Unified Diff: chrome/browser/chromeos/policy/upload_job_impl.cc

Issue 1923943003: Add logging to remote commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Syslog logging in upload_job_impl Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/upload_job_impl.cc
diff --git a/chrome/browser/chromeos/policy/upload_job_impl.cc b/chrome/browser/chromeos/policy/upload_job_impl.cc
index c8a02e74dcd16eb1e90d5c41e8ffb73e17827c11..2c567f288ff491450e3453df8e9b144612238613 100644
--- a/chrome/browser/chromeos/policy/upload_job_impl.cc
+++ b/chrome/browser/chromeos/policy/upload_job_impl.cc
@@ -8,8 +8,8 @@
#include <set>
#include <utility>
+#include "base/chromeos/logging.h"
#include "base/location.h"
-#include "base/logging.h"
#include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "google_apis/gaia/gaia_constants.h"
@@ -180,6 +180,7 @@ void UploadJobImpl::Start() {
return;
DCHECK_EQ(0, retry_);
+ CHROMEOS_SYSLOG(WARNING) << "Upload job started";
RequestAccessToken();
}
@@ -256,7 +257,7 @@ bool UploadJobImpl::SetUpMultipart() {
// Issues a warning if our buffer size estimate was too small.
if (post_data_->size() > size) {
- LOG(WARNING)
+ CHROMEOS_SYSLOG(WARNING)
<< "Reallocation needed in POST data buffer. Expected maximum size "
<< size << " bytes, actual size " << post_data_->size() << " bytes.";
}
@@ -288,7 +289,7 @@ void UploadJobImpl::StartUpload() {
DCHECK(thread_checker_.CalledOnValidThread());
if (!SetUpMultipart()) {
- LOG(ERROR) << "Multipart message assembly failed.";
+ CHROMEOS_SYSLOG(ERROR) << "Multipart message assembly failed.";
state_ = ERROR;
return;
}
@@ -315,7 +316,7 @@ void UploadJobImpl::OnGetTokenFailure(
DCHECK_EQ(ACQUIRING_TOKEN, state_);
DCHECK_EQ(access_token_request_.get(), request);
access_token_request_.reset();
- LOG(ERROR) << "Token request failed: " << error.ToString();
+ CHROMEOS_SYSLOG(ERROR) << "Token request failed: " << error.ToString();
HandleError(AUTHENTICATION_ERROR);
}
@@ -323,18 +324,18 @@ void UploadJobImpl::HandleError(ErrorCode error_code) {
retry_++;
upload_fetcher_.reset();
- LOG(ERROR) << "Upload failed, error code: " << error_code;
+ CHROMEOS_SYSLOG(ERROR) << "Upload failed, error code: " << error_code;
if (retry_ >= kMaxAttempts) {
// Maximum number of attempts reached, failure.
- LOG(ERROR) << "Maximum number of attempts reached.";
+ CHROMEOS_SYSLOG(ERROR) << "Maximum number of attempts reached.";
access_token_.clear();
post_data_.reset();
state_ = ERROR;
delegate_->OnFailure(error_code);
} else {
if (error_code == AUTHENTICATION_ERROR) {
- LOG(ERROR) << "Retrying upload with a new token.";
+ CHROMEOS_SYSLOG(ERROR) << "Retrying upload with a new token.";
// Request new token and retry.
OAuth2TokenService::ScopeSet scope_set;
scope_set.insert(GaiaConstants::kDeviceManagementServiceOAuth);
@@ -348,7 +349,7 @@ void UploadJobImpl::HandleError(ErrorCode error_code) {
} else {
// Retry without a new token.
state_ = ACQUIRING_TOKEN;
- LOG(WARNING) << "Retrying upload with the same token.";
+ CHROMEOS_SYSLOG(WARNING) << "Retrying upload with the same token.";
task_runner_->PostDelayedTask(
FROM_HERE,
base::Bind(&UploadJobImpl::StartUpload, weak_factory_.GetWeakPtr()),
@@ -362,7 +363,7 @@ void UploadJobImpl::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK_EQ(UPLOADING, state_);
const net::URLRequestStatus& status = source->GetStatus();
if (!status.is_success()) {
- LOG(ERROR) << "URLRequestStatus error " << status.error();
+ CHROMEOS_SYSLOG(ERROR) << "URLRequestStatus error " << status.error();
HandleError(NETWORK_ERROR);
} else {
const int response_code = source->GetResponseCode();
@@ -374,11 +375,11 @@ void UploadJobImpl::OnURLFetchComplete(const net::URLFetcher* source) {
state_ = SUCCESS;
delegate_->OnSuccess();
} else if (response_code == net::HTTP_UNAUTHORIZED) {
- LOG(ERROR) << "Unauthorized request.";
+ CHROMEOS_SYSLOG(ERROR) << "Unauthorized request.";
HandleError(AUTHENTICATION_ERROR);
} else {
- LOG(ERROR) << "POST request failed with HTTP status code "
- << response_code << ".";
+ CHROMEOS_SYSLOG(ERROR) << "POST request failed with HTTP status code "
+ << response_code << ".";
HandleError(SERVER_ERROR);
}
}

Powered by Google App Engine
This is Rietveld 408576698