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

Commit 30e7ab46 authored by Peiyong Lin's avatar Peiyong Lin Committed by android-build-merger
Browse files

Merge "[ConfigStore] Slient log spam."

am: 925f06e8

Change-Id: Iabe789a6f00b5462248939e868ecc21de6bf2180
parents b37145e0 925f06e8
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -23,12 +23,12 @@ namespace android {
namespace hardware {
namespace hardware {
namespace details {
namespace details {


bool wouldLogInfo() {
bool wouldLogVerbose() {
    return WOULD_LOG(INFO);
    return WOULD_LOG(VERBOSE);
}
}


void logAlwaysInfo(const std::string& message) {
void logAlwaysVerbose(const std::string& message) {
    LOG(INFO) << message;
    LOG(VERBOSE) << message;
}
}


void logAlwaysError(const std::string& message) {
void logAlwaysError(const std::string& message) {
+4 −4
Original line number Original line Diff line number Diff line
@@ -29,8 +29,8 @@ namespace hardware {
namespace details {
namespace details {
// Templated classes can use the below method
// Templated classes can use the below method
// to avoid creating dependencies on liblog.
// to avoid creating dependencies on liblog.
bool wouldLogInfo();
bool wouldLogVerbose();
void logAlwaysInfo(const std::string& message);
void logAlwaysVerbose(const std::string& message);
void logAlwaysError(const std::string& message);
void logAlwaysError(const std::string& message);
}  // namespace details
}  // namespace details


@@ -92,7 +92,7 @@ decltype(V::value) get(const decltype(V::value) &defValue) {
    };
    };
    static V cachedValue = getHelper();
    static V cachedValue = getHelper();


    if (wouldLogInfo()) {
    if (wouldLogVerbose()) {
        std::string iname = __PRETTY_FUNCTION__;
        std::string iname = __PRETTY_FUNCTION__;
        // func name starts with "func = " in __PRETTY_FUNCTION__
        // func name starts with "func = " in __PRETTY_FUNCTION__
        auto pos = iname.find("func = ");
        auto pos = iname.find("func = ");
@@ -107,7 +107,7 @@ decltype(V::value) get(const decltype(V::value) &defValue) {
        oss << iname << " retrieved: "
        oss << iname << " retrieved: "
            << (cachedValue.specified ? cachedValue.value : defValue)
            << (cachedValue.specified ? cachedValue.value : defValue)
            << (cachedValue.specified ? "" : " (default)");
            << (cachedValue.specified ? "" : " (default)");
        logAlwaysInfo(oss.str());
        logAlwaysVerbose(oss.str());
    }
    }


    return cachedValue.specified ? cachedValue.value : defValue;
    return cachedValue.specified ? cachedValue.value : defValue;