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

Unified Diff: components/policy/core/common/remote_commands/remote_command_job.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: components/policy/core/common/remote_commands/remote_command_job.cc
diff --git a/components/policy/core/common/remote_commands/remote_command_job.cc b/components/policy/core/common/remote_commands/remote_command_job.cc
index fb7caacebea062d8e59863335e5520c9626f61e5..baa8710b35707e9d78b9d063b864c04e261802e2 100644
--- a/components/policy/core/common/remote_commands/remote_command_job.cc
+++ b/components/policy/core/common/remote_commands/remote_command_job.cc
@@ -7,7 +7,7 @@
#include <utility>
#include "base/bind.h"
-#include "base/logging.h"
+#include "base/chromeos/logging.h"
namespace policy {
@@ -48,8 +48,9 @@ bool RemoteCommandJob::Init(base::TimeTicks now,
issued_time_ =
now - base::TimeDelta::FromMilliseconds(command.age_of_command());
} else {
- LOG(WARNING) << "No age_of_command provided be server for command "
- << unique_id_ << ".";
+ CHROMEOS_SYSLOG(WARNING)
+ << "No age_of_command provided be server for command " << unique_id_
+ << ".";
// Otherwise, assuming the command was issued just now.
issued_time_ = now;
}
@@ -57,6 +58,23 @@ bool RemoteCommandJob::Init(base::TimeTicks now,
if (!ParseCommandPayload(command.payload()))
return false;
+ switch (command.type()) {
+ case em::RemoteCommand_Type_COMMAND_ECHO_TEST: {
+ CHROMEOS_SYSLOG(WARNING) << "Remote echo test command " << unique_id_
+ << " initialized.";
+ break;
+ }
+ case em::RemoteCommand_Type_DEVICE_REBOOT: {
+ CHROMEOS_SYSLOG(WARNING) << "Remote reboot command " << unique_id_
+ << " initialized.";
+ break;
+ }
+ case em::RemoteCommand_Type_DEVICE_SCREENSHOT: {
+ CHROMEOS_SYSLOG(WARNING) << "Remote screenshot command " << unique_id_
+ << " initialized.";
+ break;
+ }
+ }
status_ = NOT_STARTED;
return true;
}
@@ -65,12 +83,17 @@ bool RemoteCommandJob::Run(base::TimeTicks now,
const FinishedCallback& finished_callback) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (status_ == INVALID)
+ if (status_ == INVALID) {
+ CHROMEOS_SYSLOG(ERROR) << "Remote command " << unique_id_ << " is invalid.";
return false;
+ }
DCHECK_EQ(NOT_STARTED, status_);
if (IsExpired(now)) {
+ CHROMEOS_SYSLOG(ERROR) << "Remote command " << unique_id_
+ << " expired (it was issued " << now - issued_time_
+ << " ago).";
status_ = EXPIRED;
return false;
}

Powered by Google App Engine
This is Rietveld 408576698