From a67fc32a8afd225e85709301ed249c8e976d8a42 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 27 Jan 2023 16:15:52 -0800 Subject: [PATCH] fastboot: Allow using LOG(). The die() and verbose() macros are not really standard for AOSP. To allow a gradual transition off them, call InitLogging on startup. This will also allow seeing liblp logs when -v is passed. Bug: 266982466 Test: builds Change-Id: I74278bb5f698edb0dc81477a575b130b0bd11cdf --- fastboot/fastboot.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index 0aa139059..716fc4f67 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -1860,7 +1861,19 @@ static void do_wipe_super(const std::string& image, const std::string& slot_over } } +static void FastbootLogger(android::base::LogId /* id */, android::base::LogSeverity /* severity */, + const char* /* tag */, const char* /* file */, unsigned int /* line */, + const char* message) { + verbose("%s", message); +} + +static void FastbootAborter(const char* message) { + die("%s", message); +} + int FastBootTool::Main(int argc, char* argv[]) { + android::base::InitLogging(argv, FastbootLogger, FastbootAborter); + bool wants_wipe = false; bool wants_reboot = false; bool wants_reboot_bootloader = false;