UM: Dump the EvaluationContext when evaluation of a policy fails.
This gives the log reader a complete picture of the state of variables
at the time when a policy evaluation has failed.
We slightly revise the JSON output of EvaluationContext::DumpContext()
to remove trailing whitespaces (newline, etc).
BUG=chromium:387937
TEST=Observed context dumping during unit testing.
Change-Id: I33712a896225f3be97bc313468f89f9cd724673b
Reviewed-on: https://chromium-review.googlesource.com/205896
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_manager/update_manager-inl.h b/update_manager/update_manager-inl.h
index 7d7049e..b5d3651 100644
--- a/update_manager/update_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -38,7 +38,8 @@
status = (policy_.get()->*policy_method)(ec, state_.get(), &error, result,
args...);
LOG_IF(WARNING, status == EvalStatus::kFailed)
- << "Evaluating policy failed: " << error;
+ << "Evaluating policy failed: " << error
+ << "\nEvaluation context: " << ec->DumpContext();
}
// If evaluating the main policy failed, defer to the default policy.
@@ -58,7 +59,6 @@
LOG(INFO) << "Evaluating " << policy_name << " END";
- // TODO(deymo): Log the actual state used from the EvaluationContext.
return status;
}