AU: clean up logs
- don't log for each operation when doing a delta update (there are
thousands)
- Fix subprocess to only log if there is output
- Fix subprocess to say 'subprocess' rather than 'postinst', since the
sub process is not always postinst :)
BUG=5928
TEST=unit tests
Review URL: http://codereview.chromium.org/3119031
diff --git a/delta_performer.cc b/delta_performer.cc
index 8cf0226..04273f3 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -193,8 +193,12 @@
next_operation_num_ - manifest_.install_operations_size());
if (!CanPerformInstallOperation(op))
break;
- LOG(INFO) << "Performing operation " << next_operation_num_ << "/"
- << total_operations;
+ // Log every thousandth operation, and also the first and last ones
+ if ((next_operation_num_ % 1000 == 0) ||
+ (next_operation_num_ + 1 == total_operations)) {
+ LOG(INFO) << "Performing operation " << (next_operation_num_ + 1) << "/"
+ << total_operations;
+ }
bool is_kernel_partition =
(next_operation_num_ >= manifest_.install_operations_size());
if (op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
diff --git a/subprocess.cc b/subprocess.cc
index c319a22..99605dd 100755
--- a/subprocess.cc
+++ b/subprocess.cc
@@ -139,10 +139,10 @@
FreeArgv(argv.get());
if (err)
LOG(INFO) << "err is: " << err->code << ", " << err->message;
- if (child_stdout)
- LOG(INFO) << "Postinst stdout:" << child_stdout;
- if (child_stderr)
- LOG(INFO) << "Postinst stderr:" << child_stderr;
+ if (child_stdout && strlen(child_stdout))
+ LOG(INFO) << "Subprocess stdout:" << child_stdout;
+ if (child_stderr && strlen(child_stderr))
+ LOG(INFO) << "Subprocess stderr:" << child_stderr;
return success;
}