Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a67fc32a authored by David Anderson's avatar David Anderson
Browse files

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
parent a1c983e8
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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;