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

Commit 9d4b3010 authored by Mark Salyzyn's avatar Mark Salyzyn Committed by Android Git Automerger
Browse files

am 2ce1d81f: Merge "liblog: __android_log_is_loggable support Developer Options"

* commit '2ce1d81f':
  liblog: __android_log_is_loggable support Developer Options
parents 27660999 2ce1d81f
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ static int __android_log_level(const char *tag, int def)
        return def;
    }
    {
        static const char log_namespace[] = "log.tag.";
        static const char log_namespace[] = "persist.log.tag.";
        char key[sizeof(log_namespace) + strlen(tag)];

        strcpy(key, log_namespace);
@@ -37,6 +37,9 @@ static int __android_log_level(const char *tag, int def)
        if (__system_property_get(key + 8, buf) <= 0) {
            buf[0] = '\0';
        }
        if (!buf[0] && __system_property_get(key, buf) <= 0) {
            buf[0] = '\0';
        }
    }
    switch (toupper(buf[0])) {
        case 'V': return ANDROID_LOG_VERBOSE;
@@ -53,17 +56,6 @@ static int __android_log_level(const char *tag, int def)

int __android_log_is_loggable(int prio, const char *tag, int def)
{
    static char user;
    int logLevel;

    if (user == 0) {
        char buf[PROP_VALUE_MAX];
        if (__system_property_get("ro.build.type", buf) <= 0) {
            buf[0] = '\0';
        }
        user = strcmp(buf, "user") ? -1 : 1;
    }

    logLevel = (user == 1) ? def : __android_log_level(tag, def);
    int logLevel = __android_log_level(tag, def);
    return logLevel >= 0 && prio >= logLevel;
}