[logging] Use PLOG variants in some crash/feedback code
These were already logging text status, but this makes them a bit
shorter.
ZX-4110 #comment [logging] Use PLOG variants in some crash/feedback code
Change-Id: Icf6fa708c90bfcb57ebf347d9d49fb56858b12af
diff --git a/src/developer/crashpad_agent/crashpad_agent.cc b/src/developer/crashpad_agent/crashpad_agent.cc
index 0d77405..fd04205 100644
--- a/src/developer/crashpad_agent/crashpad_agent.cc
+++ b/src/developer/crashpad_agent/crashpad_agent.cc
@@ -82,9 +82,8 @@
return CrashpadAgent::TryCreate(dispatcher, std::move(services),
std::move(config));
}
- FX_LOGS(ERROR) << "failed to read default config file at "
- << kDefaultConfigPath << ": " << status << " ("
- << zx_status_get_string(status) << ")";
+ FX_PLOGS(ERROR, status) << "failed to read default config file at "
+ << kDefaultConfigPath;
FX_LOGS(FATAL) << "failed to set up crash analyzer";
return nullptr;
diff --git a/src/developer/feedback_agent/annotations.cc b/src/developer/feedback_agent/annotations.cc
index d086072..5fccf0a 100644
--- a/src/developer/feedback_agent/annotations.cc
+++ b/src/developer/feedback_agent/annotations.cc
@@ -44,9 +44,8 @@
const zx_status_t channel_status =
fdio_get_service_handle(fd, channel.reset_and_get_address());
if (channel_status != ZX_OK) {
- FX_LOGS(ERROR) << "failed to open a channel at " << kSysInfoPath << ": "
- << channel_status << " ("
- << zx_status_get_string(channel_status) << ")";
+ FX_PLOGS(ERROR, channel_status)
+ << "failed to open a channel at " << kSysInfoPath;
return std::nullopt;
}
@@ -58,14 +57,12 @@
const zx_status_t fidl_status =
device->GetBoardName(&out_status, &out_board_name);
if (fidl_status != ZX_OK) {
- FX_LOGS(ERROR) << "failed to connect to fuchsia.sysinfo.Device: "
- << fidl_status << " (" << zx_status_get_string(fidl_status)
- << ")";
+ FX_PLOGS(ERROR, fidl_status)
+ << "failed to connect to fuchsia.sysinfo.Device";
return std::nullopt;
}
if (out_status != ZX_OK) {
- FX_LOGS(ERROR) << "failed to get device board name: " << out_status << " ("
- << zx_status_get_string(out_status) << ")";
+ FX_PLOGS(ERROR, out_status) << "failed to get device board name";
return std::nullopt;
}
return out_board_name;
diff --git a/src/developer/feedback_agent/attachments.cc b/src/developer/feedback_agent/attachments.cc
index 22e258a..5b23ace 100644
--- a/src/developer/feedback_agent/attachments.cc
+++ b/src/developer/feedback_agent/attachments.cc
@@ -38,8 +38,7 @@
const zx_status_t create_status =
zx::debuglog::create(zx::resource(), ZX_LOG_FLAG_READABLE, &log);
if (create_status != ZX_OK) {
- FX_LOGS(ERROR) << "zx::debuglog::create failed: " << create_status << " ("
- << zx_status_get_string(create_status) << ")";
+ FX_PLOGS(ERROR, create_status) << "zx::debuglog::create failed";
return fit::make_result_promise<fuchsia::mem::Buffer>(fit::error());
}
diff --git a/src/developer/feedback_agent/inspect.cc b/src/developer/feedback_agent/inspect.cc
index 8b6208f..7f5834e 100644
--- a/src/developer/feedback_agent/inspect.cc
+++ b/src/developer/feedback_agent/inspect.cc
@@ -58,8 +58,7 @@
async_get_default_dispatcher(),
[cb = discovery_done_after_timeout->callback()] { cb(); }, timeout);
if (post_status != ZX_OK) {
- FX_LOGS(ERROR) << "Failed to post delayed task: " << post_status << " ("
- << zx_status_get_string(post_status) << ")";
+ FX_PLOGS(ERROR, post_status) << "Failed to post delayed task";
FX_LOGS(ERROR) << "Skipping Inspect data collection as Inspect discovery "
"is not safe without a timeout";
return fit::make_result_promise<fuchsia::mem::Buffer>(fit::error());
diff --git a/src/developer/feedback_agent/log_listener.cc b/src/developer/feedback_agent/log_listener.cc
index c133635..633f6c7 100644
--- a/src/developer/feedback_agent/log_listener.cc
+++ b/src/developer/feedback_agent/log_listener.cc
@@ -61,16 +61,14 @@
fidl::InterfaceHandle<fuchsia::logger::LogListener> log_listener_h;
binding_.Bind(log_listener_h.NewRequest());
binding_.set_error_handler([this](zx_status_t status) {
- FX_LOGS(ERROR) << "LogListener error: " << status << " ("
- << zx_status_get_string(status) << ")";
+ FX_PLOGS(ERROR, status) << "LogListener error";
done_->completer.complete_error();
Reset();
});
fuchsia::logger::LogPtr logger = services_->Connect<fuchsia::logger::Log>();
logger.set_error_handler([this](zx_status_t status) {
- FX_LOGS(ERROR) << "Lost connection to Log service: " << status << " ("
- << zx_status_get_string(status) << ")";
+ FX_PLOGS(ERROR, status) << "Lost connection to Log service";
done_->completer.complete_error();
Reset();
});
@@ -95,9 +93,8 @@
async_get_default_dispatcher(),
[cb = done_after_timeout_.callback()] { cb(); }, timeout);
if (post_status != ZX_OK) {
- FX_LOGS(ERROR)
- << "Failed to post delayed task, no timeout for log collection: "
- << post_status << " (" << zx_status_get_string(post_status) << ")";
+ FX_PLOGS(ERROR, post_status)
+ << "Failed to post delayed task, no timeout for log collection";
}
return done_->consumer.promise_or(fit::error());
diff --git a/src/developer/kernel_crash_checker/main.cc b/src/developer/kernel_crash_checker/main.cc
index 5578205..5b616d1a 100644
--- a/src/developer/kernel_crash_checker/main.cc
+++ b/src/developer/kernel_crash_checker/main.cc
@@ -35,12 +35,10 @@
const zx_status_t status =
analyzer->OnKernelPanicCrashLog(std::move(crashlog), &out_result);
if (status != ZX_OK) {
- FX_LOGS(ERROR) << "failed to connect to crash analyzer: " << status
- << " (" << zx_status_get_string(status) << ")";
+ FX_PLOGS(ERROR, status) << "failed to connect to crash analyzer";
} else if (out_result.is_err()) {
- FX_LOGS(ERROR) << "failed to process kernel panic crash log: "
- << out_result.err() << " ("
- << zx_status_get_string(out_result.err()) << ")";
+ FX_PLOGS(ERROR, out_result.err())
+ << "failed to process kernel panic crash log";
}
}