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
This commit is contained in:
David Anderson 2023-01-27 16:15:52 -08:00
parent a1c983e800
commit a67fc32a8a

View file

@ -53,6 +53,7 @@
#include <android-base/endian.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <android-base/parseint.h>
#include <android-base/parsenetaddress.h>
@ -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;